loading multi threaded library into executable enabled for single thread

Jeremy Chadwick koitsu at FreeBSD.org
Fri Sep 12 13:10:48 UTC 2008


On Fri, Sep 12, 2008 at 07:41:14AM -0400, Barry Andrews wrote:
> Do you know if this is documented in Release Notes or Known Issues or  
> somewhere?

Why would it be an "issue"?  gcc -pthread and libpthread linking is
documented pretty much everywhere on the web.  There isn't anything
broken about it, it's how it's done on older FreeBSD.

Note that all of this has significantly changed in later FreeBSD
versions, and that the 5.x series was deprecated a very long time ago.

>> On Thu, 11 Sep 2008, Barry Andrews wrote:
>>
>>> Hi All,
>>>
>>> I have a multi-threaded library that is linked against libpthread.  
>>> When I
>>> load this lib into a tclsh process on FreeBSD, I get this error,  
>>> "Recurse on
>>> private mutex". and crash. I understand that I can have this issue  
>>> when the
>>> executable is not linked against libpthread but one of the loaded  
>>> libs is.
>>> Basically, it thinks it's in single threaded mode.
>>
>> This must be an older version of FreeBSD.  I think you must
>> link your application (tclsh or whatever) against libpthread
>> in order for this to work.  The libc functions won't get properly
>> overloaded by their equivalents in libpthread unless you do
>> this.

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |



More information about the freebsd-hackers mailing list