So I have an interesting design problem. I am working on SLES 9+ Linux, the 2.6+ kernel, and have a multi-threaded application acting as an RPC client. The idea is to have multiple threads for processing requests; One such request is to run a “job” as a child process.
Now the problem is setting up the correct signal handler to work with various signals. What I did is set to a different thread to handle the signal sitting in sigwait() state, blocking all the corresponding signals in other threads. The idea is that all the signals for the process should be delivered to the signal processing stream, and the rest of the threads should only worry about processing the requests as they arrive.
All this works fine, except for those rotten children who always throw their freezes in my backyard and stomp all over my lawn ... but in all seriousness, my signal processing stream does not receive a SIGCHLD signal. My best guess about what is happening here is that since the signal stream is not a stream that spawns a child, it will not be the stream that receives SIGCHLD, but instead my workflows that did this.
Regarding my questions:
- Am I crazy about SIGCHLD not getting into the signal handler stream?
- If I'm not crazy (it's true, I know), how would you decide to fix this little problem? I am currently installing a very simple signal handler for SIGCHLD, configured for all threads, which simply passes the signal as a SIGUSR2 signal to a process group that is blocked in all threads, allowing the signal processing thread. It seems to work, but I can't help but think that I have something missing or there is a better way to handle it ... he, he realized, could handle it ... okay, I will stop now
As per David Schwartz request SLES9: NPTL 2.3.5, SLES10: NPTL2.4
source share