From b035ed05977fdef5ced4691028284b7f0ebaba19 Mon Sep 17 00:00:00 2001 From: rpj Date: Tue, 25 Jul 2000 11:27:23 +0000 Subject: 2000-07-25 Ross Johnson * dll.c (dllMain): Remove 2000-07-21 change - problem appears to be in pthread_create(). 2000-07-21 Ross Johnson * create.c (pthread_create): Set threadH to 0 (zero) everywhere. Some assignments were using NULL. Maybe it should be NULL everywhere - need to check. (I know they are nearly always the same thing - but not by definition.) * dll.c: Include resource leakage work-around. This is a partial FIXME which doesn't stop all leakage. The real problem needs to be found and fixed. - "David Baggett" * misc.c (pthread_self): Try to catch NULL thread handles at the point where they might be generated, even though they should always be valid at this point. * tsd.c (pthread_setspecific): return an error value if pthread_self() returns NULL. * sync.c (pthread_join): return an error value if pthread_self() returns NULL. * signal.c (pthread_sigmask): return an error value if pthread_self() returns NULL. --- tsd.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'tsd.c') diff --git a/tsd.c b/tsd.c index f8656ce..5183cd7 100644 --- a/tsd.c +++ b/tsd.c @@ -25,11 +25,11 @@ #include "pthread.h" #include "implement.h" - -/* TLS_OUT_OF_INDEXES not defined on WinCE */ -#ifndef TLS_OUT_OF_INDEXES -#define TLS_OUT_OF_INDEXES 0xffffffff -#endif + +/* TLS_OUT_OF_INDEXES not defined on WinCE */ +#ifndef TLS_OUT_OF_INDEXES +#define TLS_OUT_OF_INDEXES 0xffffffff +#endif int pthread_key_create (pthread_key_t * key, void (*destructor) (void *)) @@ -212,6 +212,7 @@ pthread_setspecific (pthread_key_t key, const void *value) * ENOSPC a required resource has been exhausted, * ENOSYS semaphores are not supported, * EPERM the process lacks appropriate privilege + * ENOENT the thread couldn't find it's own handle * * ------------------------------------------------------ */ @@ -227,6 +228,10 @@ pthread_setspecific (pthread_key_t key, const void *value) * thread if one wasn't explicitly created */ self = pthread_self (); + if (self == NULL) + { + return ENOENT; + } } else { -- cgit v1.2.3