summaryrefslogtreecommitdiffstats
path: root/win/tclWinThrd.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2009-01-09 11:21:45 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2009-01-09 11:21:45 (GMT)
commit4a6ee21a80ee4a00adc8da96ed88329e7faaebf4 (patch)
tree4aa51d7f8297e2b7b5f11c316610f06e345c362d /win/tclWinThrd.c
parent06b98b063ae2d87532d9940f8ff0a6409fa86f58 (diff)
downloadtcl-4a6ee21a80ee4a00adc8da96ed88329e7faaebf4.zip
tcl-4a6ee21a80ee4a00adc8da96ed88329e7faaebf4.tar.gz
tcl-4a6ee21a80ee4a00adc8da96ed88329e7faaebf4.tar.bz2
Style fixes (unfouling whitespace, sorting comments, removing useless casts, etc.)
Diffstat (limited to 'win/tclWinThrd.c')
-rw-r--r--win/tclWinThrd.c37
1 files changed, 27 insertions, 10 deletions
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);