From owner-freebsd-current Wed Sep 17 13:35:16 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id NAA08567 for current-outgoing; Wed, 17 Sep 1997 13:35:16 -0700 (PDT) Received: from hobbes.saturn-tech.com (ianh@drussell.internode.net [198.161.228.154]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id NAA08557 for ; Wed, 17 Sep 1997 13:35:12 -0700 (PDT) Received: from localhost (ianh@localhost) by hobbes.saturn-tech.com (8.8.4/8.8.2) with SMTP id OAA06882; Wed, 17 Sep 1997 14:35:18 -0600 (MDT) Date: Wed, 17 Sep 1997 14:35:18 -0600 (MDT) From: Ian Hungerford To: John Birrell cc: freebsd-current@FreeBSD.ORG Subject: Re: Thread safe libc In-Reply-To: <199709162326.XAA04662@freebsd1.cimlogic.com.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Tue, 16 Sep 1997, John Birrell wrote: > Ian, > > Your assessment is correct. The net code in libc needs work to add the > re-entrant calls which include the extra args to avoid the use of the > static variables. And then work is needed to make the traditional > functions with the static variables allocate those variables on a > per-thread basis so that they behave in the same way they do in a > sindle threaded program. OK, I'm on the job. :) Some clarification is necessary for the second part, though. Should the replacements for statics be allocated using thread specific data (destroyed when the thread terminates) or malloc() (with the caller assuming responsibility for the free() call)? I prefer the first method - the latter is indescribably ugly, and programs that want to pass pointers to these objects between threads should simply use the new _r functions. Just my $.02, of course - I'll implement it, however ugly it ends up needing to be. :) > Regards, > > -- > John Birrell - jb@cimlogic.com.au; jb@netbsd.org; jb@freebsd.org > CIMlogic Pty Ltd, GPO Box 117A, Melbourne Vic 3001, Australia +61 418 353 137 --- Ian