Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jul 1999 14:14:08 -0600
From:      Nate Williams <nate@mt.sri.com>
To:        Jin Guojun <j_guojun@lbl.gov>
Cc:        freebsd-bugs@FreeBSD.ORG
Subject:   Re: kern/11984: pthread_kill cannot kill select() threads, etc.
Message-ID:  <199907082014.OAA02122@mt.sri.com>
In-Reply-To: <199907081950.MAA47981@freefall.freebsd.org>
References:  <199907081950.MAA47981@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> From: Jin Guojun <j_guojun@lbl.gov>
> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907082014.OAA02122>