From owner-freebsd-threads@FreeBSD.ORG Tue Mar 30 06:13:35 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E60FF16A4CE for ; Tue, 30 Mar 2004 06:13:35 -0800 (PST) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id A011943D45 for ; Tue, 30 Mar 2004 06:13:35 -0800 (PST) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.10/8.12.1) with ESMTP id i2UEDYtf013265; Tue, 30 Mar 2004 09:13:34 -0500 (EST) Date: Tue, 30 Mar 2004 09:13:34 -0500 (EST) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Doug Rabson In-Reply-To: <200403300935.49999.dfr@nlsystems.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-threads@freebsd.org Subject: Re: Thread Local Storage X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2004 14:13:36 -0000 On Tue, 30 Mar 2004, Doug Rabson wrote: > On Monday 29 March 2004 23:36, Daniel Eischen wrote: > > I'd like to see libc free of TLS ;-) The _res stuff can be > > avoided by modifying the implementation to use thread-safe > > APIs. The current _res stuff can _almost_ be eliminated > > by passing using pthread_getspecific() once and passing > > the _res around internal APIs. That's actually a pretty > > simple change. > > Unfortunately pthread_setspecific() and pthread_getspecific() don't work > for non-threaded programs whereas 'int __thread errno' works anywhere. It works for libc, since libc knows whether it is threaded or not. I think libc is always going to be sort of special, especially since we seem to need the jump table for the pthread_* functions to handle the static case. I'd be in favor of not providing static thread libraries, but there was too much opposition when I brought it up... > It would even work for evil cases where libpthread is loaded after > program startup with dlopen. -- Dan Eischen