Re: System threads (pthreads)

Mike Abbott <[email protected]> Wed, 16 Apr 2008 20:49:46 -0500
Newsgroups gmane.comp.lib.state-threads.user
Message-ID <[email protected]>
> I'm interested in as many details as you can spare.

On 2002-11-26 Gene wrote this:
| I did some digging in the linuxthreads source.  I think the
| culprit is in the inlined function thread_self() which is called
| by __errno_location().  That function relies on stack pointer to
| get pthread's identity.  The "stack pointer" is just an address
| of a local variable:
| 
| #define CURRENT_STACK_FRAME  ({ char __csf; &__csf; })
| char *sp = CURRENT_STACK_FRAME;
| 
| In other words, libpthread assumes that there is only one stack
| per each pthread and thus thread id can be inferred from the
| stack pointer.  If there are stack segments other than created
| by libpthread, thread_self() may return bogus thread id.
| 
| The bottom line, I guess, is that current pthreads implementation
| cannot be mixed with any other thread library.
| 
| --Gene

I remember discussing other issues, in particular a collision on some
special memory location, but I don't recall the details.

Interop between ST and pthreads comes up repeatedly though, so if you
find a fix we'd love to receive it.



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone