From owner-freebsd-threads@FreeBSD.ORG Sun Mar 13 19:33:55 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 1A02F10656FE for ; Sun, 13 Mar 2011 19:33:55 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id EC2D38FC19 for ; Sun, 13 Mar 2011 19:33:54 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 323F646B17 for ; Sun, 13 Mar 2011 15:33:54 -0400 (EDT) Date: Sun, 13 Mar 2011 19:33:54 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: threads@FreeBSD.org Message-ID: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Cc: Subject: pthread_key_create and !-lpthreads binaries 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: Sun, 13 Mar 2011 19:33:55 -0000 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? Thanks, Robert N M Watson Computer Laboratory University of Cambridge