From owner-freebsd-bugs Thu Jul 8 13:14:30 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from ns.mt.sri.com (unknown [206.127.79.91]) by hub.freebsd.org (Postfix) with ESMTP id 504CF152FD for ; Thu, 8 Jul 1999 13:14:16 -0700 (PDT) (envelope-from nate@mt.sri.com) Received: from mt.sri.com (rocky.mt.sri.com [206.127.76.100]) by ns.mt.sri.com (8.8.8/8.8.8) with SMTP id OAA27360; Thu, 8 Jul 1999 14:14:13 -0600 (MDT) (envelope-from nate@rocky.mt.sri.com) Received: by mt.sri.com (SMI-8.6/SMI-SVR4) id OAA02122; Thu, 8 Jul 1999 14:14:08 -0600 Date: Thu, 8 Jul 1999 14:14:08 -0600 Message-Id: <199907082014.OAA02122@mt.sri.com> From: Nate Williams MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Jin Guojun Cc: freebsd-bugs@FreeBSD.ORG Subject: Re: kern/11984: pthread_kill cannot kill select() threads, etc. In-Reply-To: <199907081950.MAA47981@freefall.freebsd.org> References: <199907081950.MAA47981@freefall.freebsd.org> X-Mailer: VM 6.34 under 19.16 "Lille" XEmacs Lucid Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > From: Jin Guojun > To: freebsd-gnats-submit@freebsd.org, jin@iss-p1.lbl.gov > Cc: > Subject: Re: kern/11984: pthread_kill cannot kill select() threads, etc. > Date: Thu, 08 Jul 1999 12:46:56 -0700 Note, according the PR, you are running: >Release: FreeBSD 3.2-RELEASE i386 > > By tracing downto c_r library, two problems have been found: > > (1) pthread_exit(void *status) > { > int sig; > long l; > pthread_t pthread; > > /* Check if this thread is already in the process of exiting: */ > if ((_thread_run->flags & PTHREAD_EXITING) != 0) { > char msg[128]; > snprintf(msg,"Thread %p has called pthread_exit() from a destructor. > POSIX 1003.1 1996 s16.2.5.2 does not allow this!",_thread_run); > PANIC(msg); > } > > /* Flag this thread as exiting: */ > _thread_run->flags |= PTHREAD_EXITING; > ... > } > > PTHREAD_EXITING is defined as 0x100, but _thread_run->flags is type of > char. > > So, PTHREAD_EXITING can never be checked or set. Huh? From 3.2-stable (which is the same as 3.2R), pthread_private.h SCLASS struct pthread * volatile _thread_run struct pthread { .... /* Miscellaneous data. */ int flags; #define PTHREAD_FLAGS_PRIVATE 0x0001 #define PTHREAD_EXITING 0x0002 #define PTHREAD_FLAGS_QUEUED 0x0004 /* in queue (qe is used) */ #define PTHREAD_FLAGS_TRACE 0x0008 And, from current: SCLASS struct pthread * volatile _thread_run struct pthread { ..... /* Miscellaneous data. */ int flags; #define PTHREAD_FLAGS_PRIVATE 0x0001 #define PTHREAD_EXITING 0x0002 #define PTHREAD_FLAGS_IN_CONDQ 0x0004 /* in condition queue using qe link*/ #define PTHREAD_FLAGS_IN_WORKQ 0x0008 /* in work queue using qe link */ #define PTHREAD_FLAGS_IN_WAITQ 0x0010 /* in waiting queue using pqe link*/ #define PTHREAD_FLAGS_IN_PRIOQ 0x0020 /* in priority queue using pqe link*/ #define PTHREAD_FLAGS_TRACE 0x0040 /* for debugging purposes */ flags and PTHREAD_EXITING are different that what you claim. Which version of FreeBSD are you using? In 3.0, it was a char, so I'll bet you are using a buggy version of the library. Please update to a more recent version, which has these bugs fixed. As far as the second issue, I suspect (but did not review the code) that the error may be fixed in more recent versions of the code, which have had substantial changes since 3.0R. (Even 3.1R has most of the fixes in place.) Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message