Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 07 Sep 2010 14:18:02 +0400
From:      Alexander Pyhalov <alp@rsu.ru>
To:        Alex Dupre <ale@FreeBSD.org>
Cc:        freebsd-ports@FreeBSD.org
Subject:   Re: libthr and libc
Message-ID:  <4C86115A.5070709@rsu.ru>
In-Reply-To: <4C860D9E.5030502@FreeBSD.org>
References:  <4C8600EE.4010000@rsu.ru> <4C860D9E.5030502@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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"...

-- 
Best regards,
Alexander Pyhalov,
system administrator of Computer Center of South Federal University



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C86115A.5070709>