From owner-freebsd-stable Fri Sep 29 13: 4:38 2000 Delivered-To: freebsd-stable@freebsd.org Received: from pcnet1.pcnet.com (pcnet1.pcnet.com [204.213.232.3]) by hub.freebsd.org (Postfix) with ESMTP id A8B2637B495 for ; Fri, 29 Sep 2000 13:04:35 -0700 (PDT) Received: (from eischen@localhost) by pcnet1.pcnet.com (8.8.7/PCNet) id QAA21002; Fri, 29 Sep 2000 16:04:16 -0400 (EDT) Date: Fri, 29 Sep 2000 16:04:15 -0400 (EDT) From: Daniel Eischen To: Alfred Perlstein Cc: Roman Shterenzon , freebsd-stable@FreeBSD.ORG Subject: Re: pthreads bug? In-Reply-To: <20000929103756.I27736@fw.wintelcom.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, 29 Sep 2000, Alfred Perlstein wrote: > * Daniel Eischen [000929 04:29] wrote: > > > > I don't think it should be fixed unless we decide to remove the > > automatic locking of file descriptors. But if you do come up > > with a clean solution, please run it by me. I have some massive > > changes to the threads library that are currently under review. > > Well the hackish idea that I had was to set the thread runnable > but somehow set a flag so that it knows it's the "accept() being > broken by close() wakeup." The accept()ing thread can then unlock > the file and return EBADF or whatever it's supposed to. Probably better to handle the file descriptor being closed/removed out from under the thread in all the wrapped IO calls (read, write, send, recv, etc) in a general way, as opposed to limiting it to just accept(). A more general solution would be to set the thread runnable (like you suggested), set the interrupted flag (already present), and also set the errno appropriately. Right now, the interrupted thread sets errno itself, as opposed to relying on it being set by the waker/signaler. We'd have to go through and change this in all the wrapped IO calls as well as the places where the threads are awoken. -- Dan Eischen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message