diff options
Diffstat (limited to 'unix/tclUnixThrd.c')
-rw-r--r-- | unix/tclUnixThrd.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index e1ffb9e..789dbb6 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -9,16 +9,12 @@ * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id: tclUnixThrd.c,v 1.63 2010/06/16 14:49:51 nijtmans Exp $ */ #include "tclInt.h" #ifdef TCL_THREADS -#include <pthread.h> - typedef struct ThreadSpecificData { char nabuf[16]; } ThreadSpecificData; @@ -432,7 +428,7 @@ Tcl_MutexLock( * Double inside master lock check to avoid a race condition. */ - pmutexPtr = (pthread_mutex_t *) ckalloc(sizeof(pthread_mutex_t)); + pmutexPtr = ckalloc(sizeof(pthread_mutex_t)); pthread_mutex_init(pmutexPtr, NULL); *mutexPtr = (Tcl_Mutex)pmutexPtr; TclRememberMutex(mutexPtr); @@ -496,7 +492,7 @@ TclpFinalizeMutex( if (pmutexPtr != NULL) { pthread_mutex_destroy(pmutexPtr); - ckfree((char *) pmutexPtr); + ckfree(pmutexPtr); *mutexPtr = NULL; } } @@ -542,9 +538,9 @@ Tcl_ConditionWait( */ if (*condPtr == NULL) { - pcondPtr = (pthread_cond_t *) ckalloc(sizeof(pthread_cond_t)); + pcondPtr = ckalloc(sizeof(pthread_cond_t)); pthread_cond_init(pcondPtr, NULL); - *condPtr = (Tcl_Condition)pcondPtr; + *condPtr = (Tcl_Condition) pcondPtr; TclRememberCondition(condPtr); } MASTER_UNLOCK; @@ -626,9 +622,10 @@ TclpFinalizeCondition( Tcl_Condition *condPtr) { pthread_cond_t *pcondPtr = *(pthread_cond_t **)condPtr; + if (pcondPtr != NULL) { pthread_cond_destroy(pcondPtr); - ckfree((char *) pcondPtr); + ckfree(pcondPtr); *condPtr = NULL; } } @@ -637,7 +634,7 @@ TclpFinalizeCondition( /* *---------------------------------------------------------------------- * - * TclpReaddir, TclpLocaltime, TclpGmtime, TclpInetNtoa -- + * TclpReaddir, TclpInetNtoa -- * * These procedures replace core C versions to be used in a threaded * environment. |