diff options
author | rpj <rpj> | 2003-09-02 16:15:05 +0000 |
---|---|---|
committer | rpj <rpj> | 2003-09-02 16:15:05 +0000 |
commit | 879bb0613c03b10bdf91aa862c2463b7f9f99087 (patch) | |
tree | 6e91c26a0f16a0e4bfd3ed436f27e470b5db7307 /pthread_exit.c | |
parent | a5f3d62017a8e705016d0083a24837d6a56f178d (diff) |
Added cancelation of/from non-POSIX threads; minor fixes; minor changes.snap-2003-09-03
Diffstat (limited to 'pthread_exit.c')
-rw-r--r-- | pthread_exit.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/pthread_exit.c b/pthread_exit.c index dfbc45b..da19063 100644 --- a/pthread_exit.c +++ b/pthread_exit.c @@ -67,29 +67,33 @@ pthread_exit (void *value_ptr) { pthread_t self; - /* If the current thread is implicit it was not started through - pthread_create(), therefore we cleanup and end the thread - here. Otherwise we raise an exception to unwind the exception - stack. The exception will be caught by ptw32_threadStart(), - which will cleanup and end the thread for us. + /* + * Don't use pthread_self() to avoid creating an implicit POSIX thread handle + * unnecessarily. */ - self = (pthread_t) pthread_getspecific (ptw32_selfThreadKey); + #ifdef _UWIN if(--pthread_count <= 0) exit((int)value_ptr); #endif - if (self == NULL || self->implicit) + if (NULL == self) { - ptw32_callUserDestroyRoutines(self); + /* + * A POSIX thread handle was never created. I.e. this is a + * Win32 thread that has never called a pthreads-win32 routine that + * required a POSIX handle. + * + * Implicit POSIX handles are cleaned up in ptw32_throw() now. + */ #if ! defined (__MINGW32__) || defined (__MSVCRT__) _endthreadex ((unsigned) value_ptr); #else _endthread (); #endif - + /* Never reached */ } |