From owner-freebsd-ports@FreeBSD.ORG Tue Sep 7 10:18:13 2010 Return-Path: Delivered-To: freebsd-ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F31B010656DF; Tue, 7 Sep 2010 10:18:12 +0000 (UTC) (envelope-from alp@rsu.ru) Received: from mail.r61.net (mail.r61.net [195.208.245.249]) by mx1.freebsd.org (Postfix) with ESMTP id 77AD88FC24; Tue, 7 Sep 2010 10:18:11 +0000 (UTC) Received: from pyhalov.cc.rsu.ru (pyhalov.cc.rsu.ru [195.208.252.128]) (authenticated bits=0) by mail.r61.net (8.14.4/8.14.1) with ESMTP id o87AI2WL041525 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 7 Sep 2010 14:18:02 +0400 (MSD) (envelope-from alp@rsu.ru) Message-ID: <4C86115A.5070709@rsu.ru> Date: Tue, 07 Sep 2010 14:18:02 +0400 From: Alexander Pyhalov User-Agent: Thunderbird 2.0.0.23 (X11/20091202) MIME-Version: 1.0 To: Alex Dupre References: <4C8600EE.4010000@rsu.ru> <4C860D9E.5030502@FreeBSD.org> In-Reply-To: <4C860D9E.5030502@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-ports@FreeBSD.org Subject: Re: libthr and libc X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 10:18:13 -0000 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