From owner-freebsd-threads@FreeBSD.ORG Mon Mar 14 04:16:15 2011 Return-Path: Delivered-To: threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F24831065670; Mon, 14 Mar 2011 04:16:14 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.netplex.net (mail.netplex.net [204.213.176.10]) by mx1.freebsd.org (Postfix) with ESMTP id AC75D8FC0A; Mon, 14 Mar 2011 04:16:14 +0000 (UTC) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.netplex.net (8.14.4/8.14.4/NETPLEX) with ESMTP id p2E3qQPd025068; Sun, 13 Mar 2011 23:52:26 -0400 X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.netplex.net) X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-4.2.6 (mail.netplex.net [204.213.176.10]); Sun, 13 Mar 2011 23:52:26 -0400 (EDT) Date: Sun, 13 Mar 2011 23:52:26 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Robert Watson In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: threads@freebsd.org Subject: Re: pthread_key_create and !-lpthreads binaries X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Mar 2011 04:16:15 -0000 On Sun, 13 Mar 2011, Robert Watson wrote: > > Dear threading folk: > > This afternoon I wrote some threaded code for Mac OS X, and then checked it > out on FreeBSD and was a bit surprised when it compiled but didn't work. > Turns out, of course, that on Mac OS X I'd omitted -lpthread and not noticed, > as the thread primitives are in libSystem. It ran, and the reason I ran into > trouble is that, although no-op locking calls are fine, getting back > "success" from pthread_key_create() when it has actually failed is > problematic. > > Would it be possible to make the thread stub for pthread_key_create() return > an error, instead of succeeding (but not actually succeeding)? Or, perhaps > better yet, I should get a link-time error for that function, even though I > shouldn't get one for lock/unlock? I think returning an error in this case is probably correct. I can look into it if no one else gets to it before me. -- DE