in reply to Re: Sending commands to another process that isn't expecting it
in thread Sending commands to another process that isn't expecting it

There is a separate daemon running that is checking every x minutes for RSS updates. That daemon needs to be commanded by a separate process that will tell it to do certain things. I'm just curious what the best way may be to have the daemon continue to check for RSS updates but still be able to process commands. And basically the best way to get those commands to the daemon to process.
  • Comment on Re^2: Sending commands to another process that isn't expecting it

Replies are listed 'Best First'.
Re^3: Sending commands to another process that isn't expecting it
by JavaFan (Canon) on Dec 05, 2010 at 12:46 UTC
    The classical answer is a select loop. POE is a framework to do a select loop. Basically, a select loop means, you have three (possible empty) sets of filehandles: handles you want to read from, handles you want to write to, handles you're watching for errors. Using a select call (4 arg select, for details, see the manual page), you wait until "something" happens: one or more of the handles you are waiting on comes available, or a timeout happens. So, you use one of the handles to read from your pipe (or stdin), and the other handles to read your RSS feed. Do whatever is appropriate when a handle becomes available.

    Personally, for simple things, I use 4-arg select. For more complicated things, I'd use POE. (Note that POE isn't the only framework available).

      Ooo. That's pretty cool. Thanks.