Date: 04 Jun 2003 21:45:33 +0200 From: Kern Sibbald <kern@sibbald.com> To: Julian Elischer <julian@elischer.org> Cc: freebsd-threads@freebsd.org Subject: Re: FreeBSD pthread_equal "bug" Message-ID: <1054755933.13606.549.camel@rufus> In-Reply-To: <Pine.BSF.4.21.0306041129130.2846-100000@InterJet.elischer.org> References: <Pine.BSF.4.21.0306041129130.2846-100000@InterJet.elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 2003-06-04 at 20:35, Julian Elischer wrote: > On Wed, 4 Jun 2003, Jeff Roberson wrote: > > > On 4 Jun 2003, Kern Sibbald wrote: > > > > > > > > I'm not sure what the POSIX specification says, > > > if I were programming it, I would not be content > > > with the FreeBSD current implementation especially > > > considering that both Solaris and Linux do it "correctly". > > > > Would you rather your application failed immediately, or in a subtle, > > unexpected way after many hours/weeks/months of run time? Dan says the > > standard allows for immediate reuse. If that is correct, then Solaris, > > linux, and FreeBSD all do it correctly for the only definition of > > correctly that matters. > > > > Simply adding an ID is problematic because the ids will wrap. Without > > using some deterministic notification you can't be sure that it isn't an > > expired thread. > > > I will quote from "Programming with Posix threads" > by David R Butenhof.. > He is one o fthe main authors of the Posix threads standard so > I tend to treat this book as a guide.. > > "Once a thread is recycled, the thread's ID (pthread_t) is no longer > valid. You cannot join with the thread, canel it, or anything else. The > terminated thread's ID (which may be the addess of a system data > structure) may be assigned to a new thread. Instead of receiving an > ESRCH failure from your call to pthread_cancel, you would instead cancel > a different thread." > > I think that is pretty explicit as far as expected bahaviour. > > HAVING SAID THAT, it is not impossible that at some time in the future > we may use some other pthread_t type, e.g an incrementing TID, > but at this time I think we are well within the standard... > > > Julian > Nice quote. I've already headed the warning. Sorry for bothering you.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1054755933.13606.549.camel>
