in reply to Global variables and SimpleHTTP request handler

How can I share data between the request_handler and another section of the program?

use run instead of background

  • Comment on Re: Global variables and SimpleHTTP request handler

Replies are listed 'Best First'.
Re^2: Global variables and SimpleHTTP request handler
by haukex (Archbishop) on Jan 02, 2017 at 19:28 UTC

    Hi,

    use run instead of background

    This is incorrect, run does not return, and doesn't help in sharing data in the way the OP wants.

    Regards,
    -- Hauke D

      This is incorrect, run does not return, and doesn't help in sharing data in the way the OP wants.

      Why should a server daemon return?

      Run isn't responsible for sharing, run is reponsible for NOT forking, so the sharing of a global works

        Hi Anonymous,

        Again, only replacing background with run doesn't help the OP.

        run is reponsible for NOT forking, so the sharing of a global works

        When is this sharing supposed to happen? It seems the OP wants to read from the queue asynchronously, so if the main process is tied up in run, handling requests that write to the queue, when do you propose the process should read the queue? Perhaps you could show some working code as a proof-of-concept of your idea, since I can't tell whether you've got a valid point.

        Regards,
        -- Hauke D