Date: Mon, 31 Mar 2003 16:06:06 -0500 (EST) From: Robert Watson <rwatson@freebsd.org> To: Andrew Gallatin <gallatin@cs.duke.edu> Cc: freebsd-arch@freebsd.org Subject: Re: cv_timedwait() & exiting procs Message-ID: <Pine.NEB.3.96L.1030331160305.13216B-100000@fledge.watson.org> In-Reply-To: <16008.30029.620721.433243@grasshopper.cs.duke.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 31 Mar 2003, Andrew Gallatin wrote: > FreeBSD's cv_timedwait() function helpfully notices that a process is > exiting and returns EWOULDBLOCK if it is. > > However, if you call cv_timedwait() in the context of a process which is > already exiting, you always get back EWOULDBLOCK, regardless of whether > or not the timeout expired. Similarly for the cv_wait_sig() and > cv_timedwait_sig(), except they set EINTR. > > Does anyone else consider this behaviour to be a bug? I think it should > only return EWOULDBLOCK/EINTR because a process is exiting if the > process wasn't already exiting when it entered the cv_*wait* routine, > but perhaps I'm misguided... Hmm. It has always struck me that the nice thing about the SMPng synchronization primitives is that they implement well-defined anc consistent semantics in a manner consistent with other implementations of the same primitives. I'd rather see the caller test the P flags and change the arguments to cv_timedwait() than see cv_timedwait() implement unusual semantics based on process conditions. Process exiting stuff is a special case, but only from the perspective of the high level code: I think I'd be upset to find cv_timedwait() change behavior at a much lower level (i.e., in vnode handling or last reference socket handling) just because it happens to run at exit()-time. Robert N M Watson FreeBSD Core Team, TrustedBSD Projects robert@fledge.watson.org Network Associates Laboratories
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1030331160305.13216B-100000>