Re: Design hole in nptl (and more general in POSIX threads)
Jim Blandy <[email protected]> 21 Dec 2003 19:10:06 -0500
| Newsgroups | gmane.comp.lib.phil |
|---|---|
| Message-ID | <[email protected]> |
Jamie Lokier <[email protected]> writes: > It is never really portable anyway. You can't safely call > pthread_kill from a signal handler either, so a thread can't halt > itself inside a signal handler. Also, the only thread-related > async-signal-safe operation, sem_drop, is an optional part of pthreads :) I'm not sure what you mean here. The code I posted never calls pthread_kill from a signal handler. And it never has a thread send itself a signal. The signal handler makes only two function calls: one to sem_post, to tell the collector it is waiting, and one to sigsuspend, to wait for the collector's go-ahead. See handle_pause_signal. (I'm not saying this untested, never-compiled code doesn't have serious flaws. But it's intended to have well-defined behavior under POSIX, so if I've botched something, I really want to know.) (Roland pointed out my brain-dead use of assert; that's fixed in the version at http://svn.red-bean.com/repos/minor/jimb/wip/gc/threads.c).