From owner-freebsd-questions Sat Nov 25 3:16: 8 2000 Delivered-To: freebsd-questions@freebsd.org Received: from area51.v-wave.com (area51.v-wave.com [24.108.173.252]) by hub.freebsd.org (Postfix) with SMTP id 4CC9B37B4CF for ; Sat, 25 Nov 2000 03:16:02 -0800 (PST) Received: (qmail 904 invoked by uid 1001); 25 Nov 2000 11:15:56 -0000 Date: Sat, 25 Nov 2000 04:15:56 -0700 From: Chris Wasser To: freebsd-questions@FreeBSD.ORG Subject: Re: pthreads library -- bug? Message-ID: <20001125041556.A827@skunkworks.area51-arpa.mil> References: <3A1E8EF9.3F0C7582@home.com> <20001124142912.B2959@dan.emsphone.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20001124142912.B2959@dan.emsphone.com>; from dnelson@emsphone.com on Fri, Nov 24, 2000 at 02:29:12PM -0600 X-Operating-System: FreeBSD 4.2-STABLE Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, Nov 24, 2000 at 02:29:12PM -0600, Dan Nelson wrote: > In the last episode (Nov 24), Jim DeLisle said: > > I'm miffed on where the pthreads libraries are on a FreeBSD 4.0 > > install. There seems to be on in the /usr/compat/linux/lib directory, > > but I would have thought to have found a FreeBSD native version in > > /usr/lib. > > /usr/lib/libc_r.* are the pthreads libraries. Add the "-pthread" > option to your gcc compile and link lines to use them. I've actually encountered a rather strange thing with the BSD pthreads, with gethostby*() running inside a thread, it seems that neither SIGQUIT or SIGKILL will terminate the thread until it either times out or finishes [using pthread_kill()]. While I haven't investigated this much further, it seems to go all the way back to 4.1-RELEASE ... Is this a 'feature' or a bug? If the latter, I can submit a PR. Would be interested to hear if anyone else has encountered this, or if it's by design. Here's the method I try to terminate the thread with (basically fall through, until one works): 1) Unlock the quit mutex, send a signal to the thread to wakeup. 2) Try to cancel the thread. 3) Issue the inevitable pthread_kill(). To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message