diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2005-02-03 13:31:10 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2005-02-03 13:31:10 (GMT) |
commit | e5de9528c47b0d8428ea81f5fbb9da883158b435 (patch) | |
tree | bee356cc24d9055ffe4ed69c4ec7c4ecd6c97522 /generic/tclThread.c | |
parent | c7215e4e8d74a8a487a503c147aed3f1039a4864 (diff) | |
download | tcl-e5de9528c47b0d8428ea81f5fbb9da883158b435.zip tcl-e5de9528c47b0d8428ea81f5fbb9da883158b435.tar.gz tcl-e5de9528c47b0d8428ea81f5fbb9da883158b435.tar.bz2 |
Whitespace fixes and add notes to #else/#endif so it is clearer what's happening
Diffstat (limited to 'generic/tclThread.c')
-rw-r--r-- | generic/tclThread.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/generic/tclThread.c b/generic/tclThread.c index ab079c1..6fc558c 100644 --- a/generic/tclThread.c +++ b/generic/tclThread.c @@ -9,7 +9,7 @@ * 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.9 2005/01/21 17:42:27 andreas_kupries Exp $ + * RCS: @(#) $Id: tclThread.c,v 1.10 2005/02/03 13:31:10 dkf Exp $ */ #include "tclInt.h" @@ -93,7 +93,7 @@ Tcl_GetThreadData(keyPtr, size) TclThreadStorageDataKeyInit(keyPtr); #else TclpThreadDataKeyInit(keyPtr); -#endif +#endif /* USE_THREAD_STORAGE */ } /* @@ -103,18 +103,18 @@ Tcl_GetThreadData(keyPtr, size) result = TclThreadStorageDataKeyGet(keyPtr); #else result = TclpThreadDataKeyGet(keyPtr); -#endif +#endif /* USE_THREAD_STORAGE */ if (result == NULL) { result = (VOID *)ckalloc((size_t)size); memset(result, 0, (size_t)size); #ifdef USE_THREAD_STORAGE - TclThreadStorageDataKeySet(keyPtr, result); + TclThreadStorageDataKeySet(keyPtr, result); #else TclpThreadDataKeySet(keyPtr, result); -#endif +#endif /* USE_THREAD_STORAGE */ } -#else +#else /* TCL_THREADS */ if (*keyPtr == NULL) { result = (VOID *)ckalloc((size_t)size); memset((char *)result, 0, (size_t)size); @@ -122,7 +122,7 @@ Tcl_GetThreadData(keyPtr, size) TclRememberDataKey(keyPtr); } result = *(VOID **)keyPtr; -#endif +#endif /* TCL_THREADS */ return result; } @@ -153,8 +153,8 @@ TclThreadDataKeyGet(keyPtr) return (VOID *)TclThreadStorageDataKeyGet(keyPtr); #else return (VOID *)TclpThreadDataKeyGet(keyPtr); -#endif -#else +#endif /* USE_THREAD_STORAGE */ +#else /* TCL_THREADS */ char *result = *(char **)keyPtr; return (VOID *)result; #endif /* TCL_THREADS */ @@ -189,19 +189,17 @@ TclThreadDataKeySet(keyPtr, data) TclThreadStorageDataKeyInit(keyPtr); #else TclpThreadDataKeyInit(keyPtr); -#endif +#endif /* USE_THREAD_STORAGE */ } #ifdef USE_THREAD_STORAGE TclThreadStorageDataKeySet(keyPtr, data); #else TclpThreadDataKeySet(keyPtr, data); -#endif -#else +#endif /* USE_THREAD_STORAGE */ +#else /* TCL_THREADS */ *keyPtr = (Tcl_ThreadDataKey)data; #endif /* TCL_THREADS */ } - - /* *---------------------------------------------------------------------- @@ -434,16 +432,16 @@ TclFinalizeThreadData() keyPtr = (Tcl_ThreadDataKey *) keyRecord.list[i]; #ifdef TCL_THREADS #ifdef USE_THREAD_STORAGE - TclFinalizeThreadStorageData(keyPtr); + TclFinalizeThreadStorageData(keyPtr); #else TclpFinalizeThreadData(keyPtr); -#endif -#else +#endif /* USE_THREAD_STORAGE */ +#else /* TCL_THREADS */ if (*keyPtr != NULL) { ckfree((char *)*keyPtr); *keyPtr = NULL; } -#endif +#endif /* TCL_THREADS */ } TclpMasterUnlock(); } @@ -478,10 +476,10 @@ TclFinalizeSynchronization() for (i=0 ; i<keyRecord.num ; i++) { keyPtr = (Tcl_ThreadDataKey *)keyRecord.list[i]; #ifdef USE_THREAD_STORAGE - TclFinalizeThreadStorageDataKey(keyPtr); + TclFinalizeThreadStorageDataKey(keyPtr); #else TclpFinalizeThreadDataKey(keyPtr); -#endif +#endif /* USE_THREAD_STORAGE */ } if (keyRecord.list != NULL) { ckfree((char *)keyRecord.list); @@ -490,10 +488,13 @@ TclFinalizeSynchronization() keyRecord.max = 0; keyRecord.num = 0; + /* + * Call platform specific thread storage master cleanup. + */ + #ifdef USE_THREAD_STORAGE - /* call platform specific thread storage master cleanup */ TclFinalizeThreadStorage(); -#endif +#endif /* USE_THREAD_STORAGE */ for (i=0 ; i<mutexRecord.num ; i++) { mutexPtr = (Tcl_Mutex *)mutexRecord.list[i]; @@ -522,14 +523,14 @@ TclFinalizeSynchronization() condRecord.num = 0; TclpMasterUnlock(); -#else +#else /* TCL_THREADS */ if (keyRecord.list != NULL) { ckfree((char *)keyRecord.list); keyRecord.list = NULL; } keyRecord.max = 0; keyRecord.num = 0; -#endif +#endif /* TCL_THREADS */ } @@ -611,4 +612,4 @@ Tcl_MutexUnlock(mutexPtr) Tcl_Mutex *mutexPtr; { } -#endif +#endif /* !TCL_THREADS */ |