Re: Merge of nickrob-async-20060513 to mainline?

Nick Roberts
2006-10-06T02:13:31Z

> So when you want to wait, you make sure such a signal handler is
> installed for SIGCHLD, unblock SIGCHLD, and call select on a set of fds
> that includes the one written to by the signal handler. If you get a
> byte on that fd, you know there's a child ready to be waited for. When
> you're done waiting, you re-block the signal. It's possible to get
> spurious wakeups this way (for instance if a signal is received between
> the return of select and the re-blocking), but with a little care
> everything works out OK.
>
> This is actually pretty similar to the way you do it with threads.
>
> Does that make sense?

Yes I think so. I don't quite follow the explanation of pselect in the manpage
but I think you're saying that the signal handler for SIGCHLD will run even
when GDB is already in select, and can get GDB's attention by writing to a
pipe with a file descriptor that select is watching.