Re: Design hole in nptl (and more general in POSIX threads)

Jamie Lokier <[email protected]> Fri, 19 Dec 2003 23:33:13 +0000
Newsgroups gmane.comp.lib.phil
Message-ID <[email protected]>
Dragiša Durić wrote:
>   What bothers me now is... What procedures in pthread API are async
> safe? Boehm GC uses pthread_self(), as probably you too are using. Is it
> safe to use pthread_key_getspecific()?

Are you sure pthread_self() is async-signal-safe?

According to the Single Unix Specification v3, and my reading of it,
the only thread function which is async-signal-safe is sem_drop().

I wouldn't be surprised if pthread_self() isn't reliable in signal
handlers with the old LinuxThreads library which didn't use a
per-thread segment register on x86.

Thanks,
-- Jamie