From owner-freebsd-hackers@FreeBSD.ORG Fri Sep 12 15:00:23 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48CF81065676 for ; Fri, 12 Sep 2008 15:00:23 +0000 (UTC) (envelope-from titanandrews@gmail.com) Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.24]) by mx1.freebsd.org (Postfix) with ESMTP id E42128FC12 for ; Fri, 12 Sep 2008 15:00:22 +0000 (UTC) (envelope-from titanandrews@gmail.com) Received: by qw-out-2122.google.com with SMTP id 9so94794qwb.7 for ; Fri, 12 Sep 2008 08:00:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type; bh=8thqqAHmDn7GtpAETRSX8T/HPN7VAkTeWgs/LV6rSYA=; b=UoCcoQJqnEkb8s3PqP4DEZyLLk+FmNi6OEyUWR76TpZt0E0TlUYapRvvHWYfVhV5fj zzDQBa7Yo7GpwP5HdVcLUWRlpV80ynGbM0xDVrx0T9snCxKleOFfAR3r3tkywundxAPx z6zrAJdjbmGOUGgT+srNo+MTJGCnqH25wK5rU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; b=Xzf9n4L+SVncxeZlfcghbHIHKZw2tNX/I5/upI55NMVEBk3pv2VYJggCB6oChfIOWK QhKry+etFQYsMscPep2z5jOTFzwGq6+lXPfxWEQlhT2m/ZCdHQvJUTeZJ297laQ1zG2+ e190IQzRDZPxmoKWzQ3+2+MWQPfe673fiTKIQ= Received: by 10.214.10.4 with SMTP id 4mr4020900qaj.48.1221231621310; Fri, 12 Sep 2008 08:00:21 -0700 (PDT) Received: from ?192.168.3.101? ( [71.0.189.248]) by mx.google.com with ESMTPS id 2sm7814220qwi.5.2008.09.12.08.00.19 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 12 Sep 2008 08:00:20 -0700 (PDT) Message-ID: <48CA8402.5040207@gmail.com> Date: Fri, 12 Sep 2008 11:00:18 -0400 From: Barry Andrews User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Jeremy Chadwick References: <48CA555A.4050104@gmail.com> <20080912131045.GA56923@icarus.home.lan> <20080912135110.GA57637@icarus.home.lan> In-Reply-To: <20080912135110.GA57637@icarus.home.lan> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Daniel Eischen , freebsd-hackers@freebsd.org Subject: Re: loading multi threaded library into executable enabled for single thread X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Sep 2008 15:00:23 -0000 Thanks for the links! But I'm not sure what any of this has to do with this particular issue. I have an exe that does not use threads that loads a lib that is linked with libpthread. Why does different threading implementations affect what I am seeing here? Is there no way for this to work in FreeBSD v5.5? Why would this go away if I upgraded to 6.x or better? thanks, B Jeremy Chadwick wrote: > On Fri, Sep 12, 2008 at 09:26:37AM -0400, Barry Andrews wrote: > >> I don't understand. If it was not broken, then why did it change in later >> FreeBSD versions? >> > > I should be more explicit: the threading library and implementations > have changed over time. There was libc_r, then there was libthr, then > there was libkse. This is what we call "evolution". :-) > > http://www.unobvious.com/bsd/freebsd-threads.html > http://kerneltrap.org/node/624 > http://www.freebsd.org/kse/ > > The gcc -pthread flag is still there on present-day FreeBSD (6 through > HEAD), and *should* be used. You can choose not to use it but you must > ensure during linktime that you explicitly link to -lpthread. > > >> On Fri, Sep 12, 2008 at 9:10 AM, Jeremy Chadwick wrote: >> >> >>> 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 | >>> >>> >>> >> _______________________________________________ >> freebsd-hackers@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers >> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >> > >