Re: Design hole in nptl (and more general in POSIX threads)
Jim Blandy <[email protected]> 22 Dec 2003 05:21:58 -0500
| Newsgroups | gmane.comp.lib.phil |
|---|---|
| Message-ID | <[email protected]> |
<[email protected]> writes: > ... > > > > When a thread registers itself with the collector, it adds its own > > __thread structure to a global linked list. The collecting thread > > finds other threads' structures via that global linked list. So > > there's no problem there. > > What I see as "problem" here is: to know how to find whatever thread > specific data, runtime must (minimally) use pthread_self() to find for > which thread it must lookup; or some data in TLS for same thing. There > is no way __thread can pull this out of thin air - so it's no more async > safe than safer one of these two methods. Okay, I see what you were getting at now. I think the real answer is that, since no standard specifies the semantics of __thread, it's only meaningful to ask whether a specific implementation of __thread is async-safe. (Thus the form of Roland's answer.)