diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2009-01-09 11:21:45 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2009-01-09 11:21:45 (GMT) |
commit | 4a6ee21a80ee4a00adc8da96ed88329e7faaebf4 (patch) | |
tree | 4aa51d7f8297e2b7b5f11c316610f06e345c362d /win | |
parent | 06b98b063ae2d87532d9940f8ff0a6409fa86f58 (diff) | |
download | tcl-4a6ee21a80ee4a00adc8da96ed88329e7faaebf4.zip tcl-4a6ee21a80ee4a00adc8da96ed88329e7faaebf4.tar.gz tcl-4a6ee21a80ee4a00adc8da96ed88329e7faaebf4.tar.bz2 |
Style fixes (unfouling whitespace, sorting comments, removing useless casts, etc.)
Diffstat (limited to 'win')
-rw-r--r-- | win/tclAppInit.c | 4 | ||||
-rw-r--r-- | win/tclWinThrd.c | 37 |
2 files changed, 29 insertions, 12 deletions
diff --git a/win/tclAppInit.c b/win/tclAppInit.c index 05263d1..b5e5729 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclAppInit.c,v 1.26 2008/04/27 22:21:35 dkf Exp $ + * RCS: @(#) $Id: tclAppInit.c,v 1.27 2009/01/09 11:21:46 dkf Exp $ */ #include "tcl.h" @@ -81,7 +81,7 @@ main( */ #if defined(__GNUC__) - setargv( &argc, &argv ); + setargv(&argc, &argv); #endif setlocale(LC_ALL, "C"); diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index 62a538b..e4850b0 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinThrd.c,v 1.49 2008/10/13 22:51:31 patthoyts Exp $ + * RCS: @(#) $Id: tclWinThrd.c,v 1.50 2009/01/09 11:21:46 dkf Exp $ */ #include "tclWinInt.h" @@ -496,6 +496,7 @@ Tcl_MutexLock( Tcl_Mutex *mutexPtr) /* The lock */ { CRITICAL_SECTION *csPtr; + if (*mutexPtr == NULL) { MASTER_LOCK; @@ -536,6 +537,7 @@ Tcl_MutexUnlock( Tcl_Mutex *mutexPtr) /* The lock */ { CRITICAL_SECTION *csPtr = *((CRITICAL_SECTION **)mutexPtr); + LeaveCriticalSection(csPtr); } @@ -561,6 +563,7 @@ TclpFinalizeMutex( Tcl_Mutex *mutexPtr) { CRITICAL_SECTION *csPtr = *(CRITICAL_SECTION **)mutexPtr; + if (csPtr != NULL) { DeleteCriticalSection(csPtr); ckfree((char *) csPtr); @@ -633,8 +636,7 @@ Tcl_ConditionWait( * and initializing that may drop back into the Master Lock. */ - Tcl_CreateThreadExitHandler(FinalizeConditionEvent, - (ClientData) tsdPtr); + Tcl_CreateThreadExitHandler(FinalizeConditionEvent, tsdPtr); } } @@ -646,11 +648,11 @@ Tcl_ConditionWait( */ if (*condPtr == NULL) { - winCondPtr = (WinCondition *)ckalloc(sizeof(WinCondition)); + winCondPtr = (WinCondition *) ckalloc(sizeof(WinCondition)); InitializeCriticalSection(&winCondPtr->condLock); winCondPtr->firstPtr = NULL; winCondPtr->lastPtr = NULL; - *condPtr = (Tcl_Condition)winCondPtr; + *condPtr = (Tcl_Condition) winCondPtr; TclRememberCondition(condPtr); } MASTER_UNLOCK; @@ -695,7 +697,8 @@ Tcl_ConditionWait( while (!timeout && (tsdPtr->flags & WIN_THREAD_BLOCKED)) { ResetEvent(tsdPtr->condEvent); LeaveCriticalSection(&winCondPtr->condLock); - if (WaitForSingleObjectEx(tsdPtr->condEvent, wtime, TRUE) == WAIT_TIMEOUT) { + if (WaitForSingleObjectEx(tsdPtr->condEvent, wtime, + TRUE) == WAIT_TIMEOUT) { timeout = 1; } EnterCriticalSection(&winCondPtr->condLock); @@ -760,6 +763,7 @@ Tcl_ConditionNotify( { WinCondition *winCondPtr; ThreadSpecificData *tsdPtr; + if (*condPtr != NULL) { winCondPtr = *((WinCondition **)condPtr); @@ -816,6 +820,7 @@ FinalizeConditionEvent( ClientData data) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) data; + tsdPtr->flags = WIN_THREAD_UNINIT; CloseHandle(tsdPtr->condEvent); } @@ -964,7 +969,9 @@ TclpFreeAllocCache( #endif /* USE_THREAD_ALLOC */ -void *TclpThreadCreateKey (void) { +void * +TclpThreadCreateKey(void) +{ DWORD *key; key = TclpSysAlloc(sizeof *key, 0); @@ -981,7 +988,10 @@ void *TclpThreadCreateKey (void) { return key; } -void TclpThreadDeleteKey(void *keyPtr) { +void +TclpThreadDeleteKey( + void *keyPtr) +{ DWORD *key = keyPtr; if (!TlsFree(*key)) { @@ -991,7 +1001,11 @@ void TclpThreadDeleteKey(void *keyPtr) { TclpSysFree(keyPtr); } -void TclpThreadSetMasterTSD(void *tsdKeyPtr, void *ptr) { +void +TclpThreadSetMasterTSD( + void *tsdKeyPtr, + void *ptr) +{ DWORD *key = tsdKeyPtr; if (!TlsSetValue(*key, ptr)) { @@ -999,7 +1013,10 @@ void TclpThreadSetMasterTSD(void *tsdKeyPtr, void *ptr) { } } -void *TclpThreadGetMasterTSD(void *tsdKeyPtr) { +void * +TclpThreadGetMasterTSD( + void *tsdKeyPtr) +{ DWORD *key = tsdKeyPtr; return TlsGetValue(*key); |