I've got something that uses a bunch of async forks to do it's work (underneath a toolkit).
In a specific region of code, I'm forking, and then doing a blocking wait on the child process.
Is the SIGCHLD handler going to gobble the signal before the blocking wait will see it, leaving me potentially hung, or is the wait always going to get something back?
When a child process stops or terminates, SIGCHLD is sent to the parent process. The default response to the signal is to ignore it. The signal can be caught and the exit status from the child process can be obtained by immediately calling wait(2) and wait3(3C).
Sends a SIGCHLD signal to the parent process to indicate that the child process has ended. Saves the exit status of the child process so that the parent process can identify which child process (by process ID) ended and its exit status.
Upon exit, the child leaves an exit status that should be returned to the parent. So, when the child finishes it becomes a zombie. Whenever the child exits or stops, the parent is sent a SIGCHLD signal.
The sigaction() function allows the calling process to examine and/or specify the action to be associated with a specific signal.
A SIGCHLD
handler gets fired on the event, the edge, of a child process exiting. A blocking call to waitpid()
will wait for the condition, the level, of that specific child process no longer existing.
When the process exits, a SIGCHLD
will be delivered, and its handler will execute normally. If there was a waitpid()
blocking on that process, it will then return as normal, regardless of the presence of a signal handler.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With