>Hello!
>
>Is it safe to use pthreads and native threads in the same program?
>For example, create pthread and call thr_self() inside its routine?
>
>I suspect that pthreads are implemented as wrapper above native threads.
>I tried to check this in the source, but libpthread and libthread contain some 
>undefined stuff. Wh
ere should I have looked for? Maybe in kernel sources?


The code is in libc; the thread libraries are "filter" libraries which
are there for backward compatibility reasons.  Only in Solaris 9 and before
did we have separate thread libraries (libpthread being a "filter"
on libthread).  A "filter" library is a library which shows a reduced 
number of symbols from another library.

The pthread_* routines aren't wrappers as such, they're often the exact
same functions:

 nm /lib/libc.so|egrep 'thr_self|pthread_self'
[8336]  |    633404|       8|FUNC |WEAK |0    |9      |_pthread_self
[7762]  |    633404|       8|FUNC |GLOB |0    |9      |_thr_self
[429]   |    633404|       8|FUNC |LOCL |2    |9      |_ti_thr_self
[6992]  |    633404|       8|FUNC |WEAK |0    |9      |pthread_self
[8863]  |    633404|       8|FUNC |WEAK |0    |9      |thr_self


So thr_self() and pthread_self() are one and the same function (the second
column is the address of the function in the binary)

Casper

_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to