Reputation: 6899
In a program, SIGCHLD is blocked from main thread, then
But SIGCHLD is still being picked up by sigwait().
Other than unblock SIGCHLD from main() before creating threads, is there a way to make SIGCHLD bypass sigwait() ? I do not want sigwait() to handle SIGCHILD.
Thanks,
Upvotes: 1
Views: 483
Reputation: 58629
This behavior is permissible per the spec:
Signals generated for the process shall be delivered to exactly one of those threads within the process which [thread] is in a call to a sigwait() function selecting that signal or [which thread] has not blocked delivery of the signal.
(Emphasis added.)
Simply remove SIGCHLD from the waiting thread's selection mask and the program will do what you want.
Upvotes: 1