Date: Wed, 1 May 2002 10:49:37 -0700 (PDT) From: Archie Cobbs <archie@dellroad.org> To: eischen@pcnet1.pcnet.com Cc: "Jeroen Ruigrok/asmodai" <asmodai@wxs.nl>, freebsd-stable@FreeBSD.ORG Subject: Re: Bug in pthread_cancel() Message-ID: <200205011749.g41Hnbs92444@arch20m.dellroad.org> In-Reply-To: <200205011559.g41Fx4Z92027@arch20m.dellroad.org> "from Archie Cobbs at May 1, 2002 08:59:04 am"
next in thread | previous in thread | raw e-mail | index | archive | help
Archie Cobbs writes: > > >Hmm, what about just bypassing the pthread_cancel() if the > > >thread is already in the process of exiting? > > I didn't include a test case but I'll give your patch a try later today. Daniel- Your patch does not fix the problem. The call to pthread_cancel() happens before the thread starts to exit. Since the thread has deferred cancellation, it does not take effect immediately. The thread does not invoke a cancellation point until later during the execution of a cleanup hook. So I suppose another fix might be to clear the PTHREAD_CANCELLING flag when pthread_exit() is called... though I don't see how to avoid the race condition there between clearing that flag and some other thread calling pthread_cancel() later (pthread_exit() does not disable context switches while executing the cleanups). So I stand by my original patch :-) In the mean time I'll try to come up with a simple test case. Thanks, -Archie __________________________________________________________________________ Archie Cobbs * Packet Design * http://www.packetdesign.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205011749.g41Hnbs92444>