Anton Belyaev wrote:
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. Where should I have looked for? Maybe in kernel sources?


These routines are completely interoperable... you can use any
mixture, any time.  Do keep in mind that this is not a portable
construction (to other operating systems)...

Both pthread* and thr* end up calling the same underlying
functions, sometimes they _are_ the same function:

http://cvs.opensolaris.org/source/xref/on/usr/src/lib/libc/port/threads/synch.c#1771

Alternatively:

721% nm /usr/lib/libc.so.1 | egrep '\|mutex_lock$|\|pthread_mutex_lock$'
[8007]  |   529439|      37|FUNC |WEAK |0    |11     |mutex_lock
[5465]  |   529439|      37|FUNC |WEAK |0    |11     |pthread_mutex_lock
722%

- Bart

--
Bart Smaalders                  Solaris Kernel Performance
[EMAIL PROTECTED]               http://blogs.sun.com/barts
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to