libthr and libc
alp at rsu.ru
Tue Sep 7 10:18:13 UTC 2010
Thanks for explanation.
Alex Dupre wrote:
> Simple explanation: the stubs are there because you can create a
> thread-safe library and use it in a single-threaded or multi-threaded
> program. Once linked to a multi-threaded program (with -pthread) the
> library gets access to the real libthr implementations of the pthread_*
> functions, while in the single-threaded program the library will use the
> libc stubs without affecting performance.
> If you encounter errors probably your program/libraries dynamically
> loads shared libraries that link with libthr and so you eventually call
> some pthread_* functions from libc and others from libthr.
Yes, it was the case. And it was not rather simple to find out this :)
And one more interesting thing. I have a sample threaded application. On
one system it was implicitly linked to libthr (on 8.0-stable), and on
other system (8.1-RELEASE) it had to be explicitly stated "-lpthr"...
system administrator of Computer Center of South Federal University
More information about the freebsd-ports