From owner-freebsd-bugs Thu May 2 12:20:11 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 62D6F37B41B for ; Thu, 2 May 2002 12:20:02 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g42JK2v90600; Thu, 2 May 2002 12:20:02 -0700 (PDT) (envelope-from gnats) Date: Thu, 2 May 2002 12:20:02 -0700 (PDT) Message-Id: <200205021920.g42JK2v90600@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Archie Cobbs Subject: Re: bin/37614: libc_r aborts when exiting thread is canceled Reply-To: Archie Cobbs Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/37614; it has been noted by GNATS. From: Archie Cobbs To: freebsd-gnats-submit@FreeBSD.org Cc: Subject: Re: bin/37614: libc_r aborts when exiting thread is canceled Date: Thu, 2 May 2002 12:18:02 -0700 (PDT) Oops, my patch is incomplete as pointed out by Daniel Eischen. The combined patchfile (both patches are required) is below. NOTE: these patches are for -stable; -current is very similar. -Archie __________________________________________________________________________ Archie Cobbs * Packet Design * http://www.packetdesign.com Index: uthread_cancel.c =================================================================== RCS file: /home/cvs/freebsd/src/lib/libc_r/uthread/uthread_cancel.c,v retrieving revision 1.3.2.4 diff -u -r1.3.2.4 uthread_cancel.c --- uthread_cancel.c 19 Aug 2001 11:45:58 -0000 1.3.2.4 +++ uthread_cancel.c 2 May 2002 19:18:37 -0000 @@ -15,7 +15,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: */ @@ -186,7 +187,8 @@ pthread_testcancel(void) { if (((_thread_run->cancelflags & PTHREAD_CANCEL_DISABLE) == 0) && - ((_thread_run->cancelflags & PTHREAD_CANCELLING) != 0)) { + ((_thread_run->cancelflags & PTHREAD_CANCELLING) != 0) && + ((_thread_run->flags & PTHREAD_EXITING) == 0)) { /* * It is possible for this thread to be swapped out * while performing cancellation; do not allow it To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message