Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Apr 2002 23:31:34 -0400 (EDT)
From:      Daniel Eischen <eischen@pcnet1.pcnet.com>
To:        Archie Cobbs <archie@dellroad.org>
Cc:        freebsd-stable@FreeBSD.ORG
Subject:   Re: Bug in pthread_cancel()
Message-ID:  <Pine.GSO.4.10.10204302325260.7256-100000@pcnet1.pcnet.com>
In-Reply-To: <200204302302.g3UN2aS89479@arch20m.dellroad.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 30 Apr 2002, Archie Cobbs wrote:
> Hi,
> Any comments positive or negative to the patch in bin/37614 ?
> I'd like to commit this soon...
> 
>   http://www.freebsd.org/cgi/query-pr.cgi?pr=37614

The patch is for stable, but would need to be applied to -current
first (after some adjustment).

Hmm, what about just bypassing the pthread_cancel() if the
thread is already in the process of exiting?

Index: uthread_cancel.c
===================================================================
RCS file: /opt/d/CVS/src/lib/libc_r/uthread/uthread_cancel.c,v
retrieving revision 1.12
diff -u -r1.12 uthread_cancel.c
--- uthread_cancel.c	6 Mar 2002 19:28:40 -0000	1.12
+++ uthread_cancel.c	1 May 2002 02:35:23 -0000
@@ -20,7 +20,8 @@
 
 	if ((ret = _find_thread(pthread)) != 0) {
 		/* NOTHING */
-	} else if (pthread->state == PS_DEAD || pthread->state == PS_DEADLOCK) {
+	} else if (pthread->state == PS_DEAD || pthread->state == PS_DEADLOCK
+            || (pthread->flags & PTHREAD_EXITING) != 0) {
 		ret = 0;
 	} else {
 		/* Protect the scheduling queues: */


-- 
Dan Eischen


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?Pine.GSO.4.10.10204302325260.7256-100000>