From owner-freebsd-hackers Mon Dec 1 15:50:47 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id PAA04375 for hackers-outgoing; Mon, 1 Dec 1997 15:50:47 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from iworks.InterWorks.org (deischen@iworks.interworks.org [128.255.18.10]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id PAA04369 for ; Mon, 1 Dec 1997 15:50:42 -0800 (PST) (envelope-from deischen@iworks.interworks.org) Received: (from deischen@localhost) by iworks.InterWorks.org (8.7.5/) id RAA04567; Mon, 1 Dec 1997 17:53:34 -0600 (CST) Message-Id: <199712012353.RAA04567@iworks.InterWorks.org> Date: Mon, 1 Dec 1997 17:53:34 -0600 (CST) From: "Daniel M. Eischen" To: Arjan.deVet@adv.IAEhv.nl, freebsd-hackers@freebsd.org Subject: Re: pthreads Sender: owner-freebsd-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > >Anyone else out there have applications using pthreads other than Python? > > Squid 1.2beta has the possibility to use pthreads but when I tried it a > month ago I couldn't get it to run on FreeBSD (haven't tried it yet after > the recent changes to libc_r). I also tried it on BSD/OS recently and it > more or less works on BSD/OS 3.1 (not 3.0). I have some experience in getting an application working with pthreads. I ported the GNAT (Ada95) compiler to FreeBSD which uses pthreads for tasking. Until recently (last week), FreeBSD pthreads returned non-standard error codes. The POSIX spec specifies that the error codes should (shall) be returned to the caller as the return value from the pthread function call. FreeBSD was returning -1, and setting the thread-safe errno to the error code. For instance, a timedout call to pthread_cond_timedwait() would return -1 and set errno to EAGAIN, instead of returning ETIMEDOUT and leaving errno untouched. GNAT uses pthread_cond_timedwait as its mechanism for performing tasking delays and other timed operations. Until I accounted for this non-standard operation, GNAT tasking would not work properly. If you've got access to a -current box, try squid or python on there with the changes to pthreads. Or, you can search for all pthread calls and see if they are relying on error codes being returned from the calls. It is easy enough to search the pthread source in lib/libc_r/uthread/... to see exactly what FreeBSD is returning. Note if you are able to make Squid or Python work with our pthreads, it'd be nice to make it work for both the standard and non-standard versions :-) Dan Eischen deischen@iworks.InterWorks.org