diff options
author | georgeps <georgeps@noemail.net> | 2008-05-09 04:58:51 (GMT) |
---|---|---|
committer | georgeps <georgeps@noemail.net> | 2008-05-09 04:58:51 (GMT) |
commit | ef8ba0526e657834ffc8ffc43b0d501b915ce22f (patch) | |
tree | 2a1b16698533508941b5316630a09d07a0ffac94 /generic/tclThread.c | |
parent | 856afebf44b7679bbf269a6cf6d766d454881e81 (diff) | |
download | tcl-ef8ba0526e657834ffc8ffc43b0d501b915ce22f.zip tcl-ef8ba0526e657834ffc8ffc43b0d501b915ce22f.tar.gz tcl-ef8ba0526e657834ffc8ffc43b0d501b915ce22f.tar.bz2 |
* generic/tcl.h: Make Tcl_ThreadDataKey a void *.
* generic/tclInt.h: Change around some function names and
add some new per-platform declarations for thread-specific data
functions.
* generic/tclThread.c: Make use of of the new function names
that no longer have a Tclp prefix.
* generic/tclThreadStorage.c: Replace the core thread-specific data
(TSD) mechanism with an array offset solution that eliminates the
hash tables, and only uses one slot of native TSD.
Many thanks to Kevin B. Kenny for his help with this.
* unix/tclUnixThrd.c: Add platform-specific TSD functions for use
by tclThreadStorage.c.
* win/tclWinThrd.c: Add platform-specific TSD functions for use
by tclThreadStorage.c.
FossilOrigin-Name: 2fd77728e652c144a667b0bc20caed9f929c20fa
Diffstat (limited to 'generic/tclThread.c')
-rw-r--r-- | generic/tclThread.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/generic/tclThread.c b/generic/tclThread.c index 1ab4bc9..1a544e3 100644 --- a/generic/tclThread.c +++ b/generic/tclThread.c @@ -5,11 +5,12 @@ * the real work is done in the platform dependent files. * * Copyright (c) 1998 by Sun Microsystems, Inc. + * Copyright (c) 2008 by George Peter Staplin * * 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.19 2007/12/13 15:23:20 dgp Exp $ + * RCS: @(#) $Id: tclThread.c,v 1.20 2008/05/09 04:58:54 georgeps Exp $ */ #include "tclInt.h" @@ -84,21 +85,22 @@ Tcl_GetThreadData( /* * Initialize the key for this thread. */ - result = TclpThreadDataKeyGet(keyPtr); + result = TclThreadStorageKeyGet(keyPtr); if (result == NULL) { - result = ckalloc((size_t) size); - memset(result, 0, (size_t) size); - TclpThreadDataKeySet(keyPtr, result); + result = ckalloc((size_t)size); + memset(result, 0, (size_t)size); + TclThreadStorageKeySet(keyPtr, result); } #else /* TCL_THREADS */ if (*keyPtr == NULL) { - result = ckalloc((size_t) size); - memset(result, 0, (size_t) size); - *keyPtr = (Tcl_ThreadDataKey)result; + result = ckalloc((size_t)size); + memset(result, 0, (size_t)size); + *keyPtr = result; RememberSyncObject((char *) keyPtr, &keyRecord); + } else { + result = *keyPtr; } - result = * (void **) keyPtr; #endif /* TCL_THREADS */ return result; } @@ -122,14 +124,13 @@ Tcl_GetThreadData( void * TclThreadDataKeyGet( - Tcl_ThreadDataKey *keyPtr) /* Identifier for the data chunk, really - * (pthread_key_t **) */ + Tcl_ThreadDataKey *keyPtr) /* Identifier for the data chunk. */ + { #ifdef TCL_THREADS - return TclpThreadDataKeyGet(keyPtr); + return TclThreadStorageKeyGet(keyPtr); #else /* TCL_THREADS */ - char *result = *(char **) keyPtr; - return result; + return *keyPtr; #endif /* TCL_THREADS */ } @@ -355,7 +356,7 @@ Tcl_ConditionFinalize( void TclFinalizeThreadData(void) { - TclpFinalizeThreadDataThread(); + TclFinalizeThreadDataThread(); } /* @@ -396,7 +397,7 @@ TclFinalizeSynchronization(void) if (keyRecord.list != NULL) { for (i=0 ; i<keyRecord.num ; i++) { keyPtr = (Tcl_ThreadDataKey *) keyRecord.list[i]; - blockPtr = (void *) *keyPtr; + blockPtr = *keyPtr; ckfree(blockPtr); } ckfree((char *) keyRecord.list); |