Re: Design hole in nptl (and more general in POSIX threads)
Jim Blandy <[email protected]> 21 Dec 2003 19:16:02 -0500
| Newsgroups | gmane.comp.lib.phil |
|---|---|
| Message-ID | <[email protected]> |
[GNUS seems to have botched the encoding of my first reply. Let me try again.] <[email protected]> writes: > > My __thread structure contains the links of the list of threads to > > send signals to. Both adding threads to the list and traversing the > > list sending signals require code to hold the same mutex. So I have > > always referenced my thread structure before using it in the signal > > handler. And I don't make any first references to TLS in my signal > > handlers. So it sounds like I'm okay. > > But, you referenced TLS variable in another thread? Signal handler for > every thread happens in it's thread so you have now reference when your > signal handler asks for that ("same") variable. 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.