[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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

Jim Blandy wrote:
> Using __thread variables is async-safe.

Are you sure?  I'd expect them to be async-signal-unsafe if there is
dynamic lazy resolution of __thread storage blocks, and you haven't
accessed that variable in that thread yet.  In your example you have
accessed it, obviously.

In principle I'd expect the compiler to use pthread_key_getspecific()
or some similar low level libc routine to access variables declared in
that way although I don't know if any actually do that.

> pthread_self (which isn't officially async-signal-safe, but geez)

On some implementations pthread_self has to search a data structure
which is modified and hence locked whenever threads are created or
destroyed.  It's not surprising that it's not async-signal-safe.  I
think an older version of Glibc threads was like this on some

-- Jamie

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]