diff options
Diffstat (limited to 'generic/tclThread.c')
| -rw-r--r-- | generic/tclThread.c | 25 | 
1 files changed, 14 insertions, 11 deletions
| diff --git a/generic/tclThread.c b/generic/tclThread.c index 58cc18d..8c972a8 100644 --- a/generic/tclThread.c +++ b/generic/tclThread.c @@ -9,8 +9,6 @@   *   * See the file "license.terms" for information on usage and redistribution of   * this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id: tclThread.c,v 1.25 2009/03/16 00:43:09 mistachkin Exp $   */  #include "tclInt.h" @@ -85,16 +83,17 @@ Tcl_GetThreadData(      /*       * Initialize the key for this thread.       */ +      result = TclThreadStorageKeyGet(keyPtr);      if (result == NULL) { -	result = ckalloc((size_t)size); +	result = ckalloc(size);  	memset(result, 0, (size_t) size);  	TclThreadStorageKeySet(keyPtr, result);      }  #else /* TCL_THREADS */      if (*keyPtr == NULL) { -	result = ckalloc((size_t)size); +	result = ckalloc(size);  	memset(result, 0, (size_t)size);  	*keyPtr = result;  	RememberSyncObject(keyPtr, &keyRecord); @@ -180,14 +179,14 @@ RememberSyncObject(      if (recPtr->num >= recPtr->max) {  	recPtr->max += 8; -	newList = (void **) ckalloc(recPtr->max * sizeof(void *)); +	newList = ckalloc(recPtr->max * sizeof(void *));  	for (i=0,j=0 ; i<recPtr->num ; i++) {  	    if (recPtr->list[i] != NULL) {  		newList[j++] = recPtr->list[i];  	    }  	}  	if (recPtr->list != NULL) { -	    ckfree((char *) recPtr->list); +	    ckfree(recPtr->list);  	}  	recPtr->list = newList;  	recPtr->num = j; @@ -340,8 +339,9 @@ Tcl_ConditionFinalize(   *   * TclFinalizeThreadData --   * - *	This function cleans up the thread-local storage. This is called once - *	for each thread. + *	This function cleans up the thread-local storage. Secondary, it cleans + *	thread alloc cache. + *	This is called once for each thread before thread exits.   *   * Results:   *	None. @@ -356,6 +356,9 @@ void  TclFinalizeThreadData(void)  {      TclFinalizeThreadDataThread(); +#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) +    TclFinalizeThreadAllocThread(); +#endif  }  /* @@ -399,7 +402,7 @@ TclFinalizeSynchronization(void)  	    blockPtr = *keyPtr;  	    ckfree(blockPtr);  	} -	ckfree((char *) keyRecord.list); +	ckfree(keyRecord.list);  	keyRecord.list = NULL;      }      keyRecord.max = 0; @@ -419,7 +422,7 @@ TclFinalizeSynchronization(void)  	}      }      if (mutexRecord.list != NULL) { -	ckfree((char *) mutexRecord.list); +	ckfree(mutexRecord.list);  	mutexRecord.list = NULL;      }      mutexRecord.max = 0; @@ -432,7 +435,7 @@ TclFinalizeSynchronization(void)  	}      }      if (condRecord.list != NULL) { -	ckfree((char *) condRecord.list); +	ckfree(condRecord.list);  	condRecord.list = NULL;      }      condRecord.max = 0; | 
