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. | [reply] |
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).
| [reply] |
| [reply] |