If you have a small number of threads, pthread_self() with
LinuxThreads is ok. It searches a linear array to find which stack
contains the current stack pointer.
This is what I meant by "doing TLS with a library call" in the other
message.
With LinuxThreads you can use the portable pthreads method:
pthread_getspecific(). It's not as fast as TLS, but not slow either.
more (slow) library calls... :(
And additionally you need a key.
With the code I need to port, I'd need a thread specific value (e.g. a
thread ID) somewhere deep in nested function calls. So I don't want to
modify the code that this value is additionally passed by _all_
functions. So I suppose "__thread" is the only viable standard way to do
this. (As a propriety way would be to use pthread_self() and store some
value at the bottom of the stack when initializing the thread: not nice
at all)
- Michael
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev