
So basically such thread need
forever ( sigwait(sigchld) foreach pid in waiting set if(waitpid(pid, WNOHANG) = done) notify io_service remove pid from waiting set }
you iterate over the complete set of pids you are waiting for. why not let waitpid( -1,...) let tell which child has changed its status.
Because it can accidentally catch an exit code of normal wait for example consider that other thread waits synchronously, this was the problem I've told in the original review notes the race condition between waiting thread and other thread that makes synchornous wait. This is why you can't use waitpid with -1 or wait that catches any child.
Shouldn't the wait-functionality be interrupt-able? How to do a grace full shutdown if forever blocking?
It can be done with other signal - you can use real-time signals to notify the thread on interruption. Artyom