I believe the patch is correct and fixes the 9347 bug.
But I suspect we have other issues here. Let's suppose we have threads T1 (main)
and T2. T2 blocks SIGCHLD and does sigwait(SIGCHLD).
Now, we send SIGCHLD to the thread group. The signal is lost again because
sig_ignored() returns true on T1's side.
Is this OK? For example, let's modify the test-case:
void *tfunc(void *arg)
{
sleep(1);
if (!fork())
exit(0);
for (;;)
pause();
}
int main(void)
{
pthread_t pt;
sigset_t set;
int signum;
pthread_create(&pt, 0, tfunc, 0);
sigemptyset(&set);
sigaddset(&set, SIGCHLD);
sigprocmask(SIG_BLOCK, &set, NULL);
sigwait(&set, &signum);
return 0;
}
I bet sigwait() will hang again.
I think __group_send_sig_info() shouldn't use sig_ignored() at all. Instead,
we should split __group_complete_signal() into 2 functions. The first one, say,
choose_target() shoud be used instead. The second one, handle_fatal_signal()
can also be used by tkill() and friends.
What do you think?
Actually, I was going to do this cleanup a long ago, but can't find the time
to try to do this.
Oleg.
-