Re: Design hole in nptl (and more general in POSIX threads)
Dragiša Durić <[email protected]> Fri, 19 Dec 2003 18:31:53 +0100
| Newsgroups | gmane.comp.lib.phil |
|---|---|
| Message-ID | <[email protected]> |
Jim, Thank you very much! Together with few pieces of Boehm GC, this looks like enough information for me to finish this stack examining. In fact, I only have to make hash table for low level mapping of pthread_t to traced references of Modula-3 Thread.T object to (I hope :)) finish my work. 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()? Thanks, dd Дана сре, 17-12-2003 у 21:12, Jim Blandy је написао: > You may find these helpful: > > http://svn.red-bean.com/repos/minor/trunk/gc/threads.c > http://svn.red-bean.com/repos/minor/trunk/gc/threads.h > > They are a work in progress, and are completely untested; I haven't > even compiled them yet. (Hopefully I'll be able to do that in the > next few weeks.) But there are extensive comments explaining how it's > supposed to work, which might give you some ideas. > > The general approach to stopping threads is borrowed from the Boehm > GC, but this is a precise GC, and I have arranged the user's API so > that I don't need to intercept thread creation calls or do the other > strange things Boehm does. > > It does depend on architecture-specific memory barrier functions; > POSIX doesn't include any functions that both synchronize memory and > are async-safe. > > The "Minor C API" referred to in the comments is here, but you should > be able to make sense of threads.[ch] without reading it: > > http://svn.red-bean.com/repos/minor/trunk/include/minor/minor.h >