From owner-freebsd-threads@FreeBSD.ORG Mon Sep 27 15:49:49 2010 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFC3E1065714; Mon, 27 Sep 2010 15:49:49 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id C01988FC19; Mon, 27 Sep 2010 15:49:49 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 6CED346C0C; Mon, 27 Sep 2010 11:49:49 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 9F3AD8A050; Mon, 27 Sep 2010 11:49:47 -0400 (EDT) From: John Baldwin To: freebsd-threads@freebsd.org Date: Mon, 27 Sep 2010 11:46:27 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009261711.o8QHBqSR064732@freefall.freebsd.org> In-Reply-To: <201009261711.o8QHBqSR064732@freefall.freebsd.org> MIME-Version: 1.0 Message-Id: <201009271146.28000.jhb@freebsd.org> Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 27 Sep 2010 11:49:48 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: arundel@freebsd.org, freebsd-bugs@freebsd.org Subject: Re: misc/150959: [libc] Stub pthread_once in libc should call _libc_once X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 15:49:50 -0000 On Sunday, September 26, 2010 1:11:52 pm arundel@freebsd.org wrote: > Old Synopsis: Stub pthread_once in libc should call _libc_once > New Synopsis: [libc] Stub pthread_once in libc should call _libc_once > > Responsible-Changed-From-To: freebsd-bugs->freebsd-threads > Responsible-Changed-By: arundel > Responsible-Changed-When: Sun Sep 26 17:08:28 UTC 2010 > Responsible-Changed-Why: > Over to maintainer(s). As you note in the history, libstdc++ depends on this behavior, so it is not likely to be changed. Possibly changing the stub to always return an error would be ok, except that POSIX defines no errors for pthread_once(). Note that this behavior also matches Solaris apparently: (From /usr/include/c++/4.2/bits/gthr-default.h) #if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK /* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if -pthreads is not specified. The functions are dummies and most return an error value. However pthread_once returns 0 without invoking the routine it is passed so we cannot pretend that the interface is active if -pthreads is not specified. On Solaris 2.5.1, the interface is not exposed at all so we need to play the usual game with weak symbols. On Solaris 10 and up, a working interface is always exposed. On FreeBSD 6 and later, libc also exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc, which means the alternate __gthread_active_p below cannot be used there. */ #if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__)) To be honest, I would favor libc exporting '__isthreaded' in some fashion so that libstdc++ could depend on that instead. I think the symbol is already public so that libthr can set it. -- John Baldwin