From owner-freebsd-current Wed Dec 23 05:12:23 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id FAA14396 for freebsd-current-outgoing; Wed, 23 Dec 1998 05:12:23 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from ns.tar.com (ns.tar.com [204.95.187.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id FAA14390 for ; Wed, 23 Dec 1998 05:12:20 -0800 (PST) (envelope-from dick@ns.tar.com) Received: (from dick@localhost) by ns.tar.com (8.9.1/8.9.1) id HAA77531; Wed, 23 Dec 1998 07:10:40 -0600 (CST) (envelope-from dick) Date: Wed, 23 Dec 1998 07:10:40 -0600 From: Richard Seaman To: Jeremy Lea Cc: freebsd-current@FreeBSD.ORG Subject: Re: Threads in WINE [was: linking against libc_r] Message-ID: <19981223071040.A77487@ns.tar.com> References: <19981221093241.C546@tar.com> <19981221192734.E4060@shale.csir.co.za> <19981221114939.A5500@tar.com> <19981223001304.A319@shale.csir.co.za> <19981222174945.A69445@tar.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95i In-Reply-To: <19981222174945.A69445@tar.com>; from Richard Seaman on Tue, Dec 22, 1998 at 05:49:45PM -0600 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, Dec 22, 1998 at 05:49:45PM -0600, Richard Seaman wrote: > > The FreeBSD libc can be partly re-entrant now. In order to make the portions > of libc that are designed to be re-entrannt actually behave in that manner, > you need to satisfy the following three conditions: > > 1) You must set the libc variable (which is visible externally) > __isthreaded to a non zero value. > > 2) You must provide an implementation of the function _spinlock > which is declared in src/lib/libc/include/spinlock.h. The > implementation probably needs to be "recursive" if you're going > to get optimum results. > > _spinlock needs to override the weak aliased _spinlock that > is implemented in libc as a stub function > > 3) You must provide implementations of flockfile, ftrylockfile, > and funlockfile. Maybe also _flockfile_debug if you're going > to use the debug version. > > These need to override the weak aliases for these functions > in libc, which are also just stub functions. > > If you link with the libpthreads that is generated by the > liblinuxthreads "port" noted above, you should get the > three conditions met. My brain was only partly in gear when I wrote this. There is an important fourth condition imposed by the specific implementations of _spinlock, flockfile, ftrylockfile and funlockfile included with liblinuxthreads. They all use pthread_self, or its relative, thread_self. You must create your threads using pthread_create for pthread_self to work. -- Richard Seamman, Jr. email: dick@tar.com 5182 N. Maple Lane phone: 414-367-5450 Chenequa WI 53058 fax: 414-367-5852 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message