diff options
-rw-r--r-- | generic/tclInt.h | 28 | ||||
-rw-r--r-- | generic/tclThread.c | 22 | ||||
-rw-r--r-- | generic/tclThreadStorage.c | 32 | ||||
-rw-r--r-- | generic/tclUtil.c | 4 | ||||
-rw-r--r-- | library/tcltest/tcltest.tcl | 16 | ||||
-rw-r--r-- | tests/chanio.test | 12 | ||||
-rw-r--r-- | tests/event.test | 2 | ||||
-rw-r--r-- | tests/init.test | 10 | ||||
-rw-r--r-- | tests/io.test | 33 | ||||
-rw-r--r-- | tests/package.test | 10 | ||||
-rw-r--r-- | unix/tclUnixThrd.c | 42 | ||||
-rw-r--r-- | win/tclWinNotify.c | 4 | ||||
-rw-r--r-- | win/tclWinThrd.c | 56 |
13 files changed, 134 insertions, 137 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h index afb431c..c3801ee 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1856,7 +1856,7 @@ typedef struct Interp { * of hidden commands on a per-interp * basis. */ void *interpInfo; /* Information used by tclInterp.c to keep - * track of master/slave interps on a + * track of parent/child interps on a * per-interp basis. */ union { void (*optimizer)(void *envPtr); @@ -2146,7 +2146,7 @@ typedef struct Interp { * (c) are accessed very often (e.g., at each command call) * * Note that these are the same for all interps in the same thread. They - * just have to be initialised for the thread's master interp, slaves + * just have to be initialised for the thread's parent interp, children * inherit the value. * * They are used by the macros defined below. @@ -2669,20 +2669,20 @@ typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, unsigned int *leng /* * A ProcessGlobalValue struct exists for each internal value in Tcl that is * to be shared among several threads. Each thread sees a (Tcl_Obj) copy of - * the value, and the master is kept as a counted string, with epoch and mutex - * control. Each ProcessGlobalValue struct should be a static variable in some - * file. + * the value, and the gobal value is kept as a counted string, with epoch and + * mutex control. Each ProcessGlobalValue struct should be a static variable in + * some file. */ typedef struct ProcessGlobalValue { unsigned int epoch; /* Epoch counter to detect changes in the - * master value. */ - unsigned int numBytes; /* Length of the master string. */ - char *value; /* The master string value. */ - Tcl_Encoding encoding; /* system encoding when master string was + * global value. */ + unsigned int numBytes; /* Length of the global string. */ + char *value; /* The global string value. */ + Tcl_Encoding encoding; /* system encoding when global string was * initialized. */ TclInitProcessGlobalValueProc *proc; - /* A procedure to initialize the master string + /* A procedure to initialize the global string * copy when a "get" request comes in before * any "set" request has been received. */ Tcl_Mutex mutex; /* Enforce orderly access from multiple @@ -3157,8 +3157,8 @@ MODULE_SCOPE void TclpInitLock(void); MODULE_SCOPE void TclpInitPlatform(void); MODULE_SCOPE void TclpInitUnlock(void); MODULE_SCOPE Tcl_Obj * TclpObjListVolumes(void); -MODULE_SCOPE void TclpMasterLock(void); -MODULE_SCOPE void TclpMasterUnlock(void); +MODULE_SCOPE void TclpGlobalLock(void); +MODULE_SCOPE void TclpGlobalUnlock(void); MODULE_SCOPE int TclpMatchFiles(Tcl_Interp *interp, char *separators, Tcl_DString *dirPtr, char *pattern, char *tail); MODULE_SCOPE int TclpObjNormalizePath(Tcl_Interp *interp, @@ -3305,8 +3305,8 @@ MODULE_SCOPE Tcl_WideInt TclpGetMicroseconds(void); MODULE_SCOPE int TclZlibInit(Tcl_Interp *interp); MODULE_SCOPE void * TclpThreadCreateKey(void); MODULE_SCOPE void TclpThreadDeleteKey(void *keyPtr); -MODULE_SCOPE void TclpThreadSetMasterTSD(void *tsdKeyPtr, void *ptr); -MODULE_SCOPE void * TclpThreadGetMasterTSD(void *tsdKeyPtr); +MODULE_SCOPE void TclpThreadSetGlobalTSD(void *tsdKeyPtr, void *ptr); +MODULE_SCOPE void * TclpThreadGetGlobalTSD(void *tsdKeyPtr); MODULE_SCOPE void TclErrorStackResetIf(Tcl_Interp *interp, const char *msg, int length); /* Tip 430 */ diff --git a/generic/tclThread.c b/generic/tclThread.c index f22653a..76aaf4b 100644 --- a/generic/tclThread.c +++ b/generic/tclThread.c @@ -126,7 +126,7 @@ TclThreadDataKeyGet( * Keep a list of (mutexes/condition variable/data key) used during * finalization. * - * Assume master lock is held. + * Assume global lock is held. * * Results: * None. @@ -187,7 +187,7 @@ RememberSyncObject( * ForgetSyncObject * * Remove a single object from the list. - * Assume master lock is held. + * Assume global lock is held. * * Results: * None. @@ -219,7 +219,7 @@ ForgetSyncObject( * TclRememberMutex * * Keep a list of mutexes used during finalization. - * Assume master lock is held. + * Assume global lock is held. * * Results: * None. @@ -262,9 +262,9 @@ Tcl_MutexFinalize( #if TCL_THREADS TclpFinalizeMutex(mutexPtr); #endif - TclpMasterLock(); + TclpGlobalLock(); ForgetSyncObject(mutexPtr, &mutexRecord); - TclpMasterUnlock(); + TclpGlobalUnlock(); } /* @@ -273,7 +273,7 @@ Tcl_MutexFinalize( * TclRememberCondition * * Keep a list of condition variables used during finalization. - * Assume master lock is held. + * Assume global lock is held. * * Results: * None. @@ -316,9 +316,9 @@ Tcl_ConditionFinalize( #if TCL_THREADS TclpFinalizeCondition(condPtr); #endif - TclpMasterLock(); + TclpGlobalLock(); ForgetSyncObject(condPtr, &condRecord); - TclpMasterUnlock(); + TclpGlobalUnlock(); } /* @@ -382,7 +382,7 @@ TclFinalizeSynchronization(void) Tcl_Mutex *mutexPtr; Tcl_Condition *condPtr; - TclpMasterLock(); + TclpGlobalLock(); #endif /* @@ -404,7 +404,7 @@ TclFinalizeSynchronization(void) #if TCL_THREADS /* - * Call thread storage master cleanup. + * Call thread storage global cleanup. */ TclFinalizeThreadStorage(); @@ -435,7 +435,7 @@ TclFinalizeSynchronization(void) condRecord.max = 0; condRecord.num = 0; - TclpMasterUnlock(); + TclpGlobalUnlock(); #endif /* TCL_THREADS */ } diff --git a/generic/tclThreadStorage.c b/generic/tclThreadStorage.c index 99e6bac..74c23af 100644 --- a/generic/tclThreadStorage.c +++ b/generic/tclThreadStorage.c @@ -27,11 +27,11 @@ */ /* - * The master collection of information about TSDs. This is shared across the + * The global collection of information about TSDs. This is shared across the * whole process, and includes the mutex used to protect it. */ -static struct TSDMaster { +static struct { void *key; /* Key into the system TSD structure. The * collection of Tcl TSD values for a * particular thread will hang off the @@ -41,13 +41,13 @@ static struct TSDMaster { * increasing value. */ Tcl_Mutex mutex; /* Protection for the rest of this structure, * which holds per-process data. */ -} tsdMaster = { NULL, 0, NULL }; +} tsdGlobal = { NULL, 0, NULL }; /* * The type of the data held per thread in a system TSD. */ -typedef struct TSDTable { +typedef struct { ClientData *tablePtr; /* The table of Tcl TSDs. */ sig_atomic_t allocated; /* The size of the table in the current * thread. */ @@ -57,7 +57,7 @@ typedef struct TSDTable { * The actual type of Tcl_ThreadDataKey. */ -typedef union TSDUnion { +typedef union { volatile sig_atomic_t offset; /* The type is really an offset into the * thread-local table of TSDs, which is this @@ -189,7 +189,7 @@ void * TclThreadStorageKeyGet( Tcl_ThreadDataKey *dataKeyPtr) { - TSDTable *tsdTablePtr = (TSDTable *)TclpThreadGetMasterTSD(tsdMaster.key); + TSDTable *tsdTablePtr = (TSDTable *)TclpThreadGetGlobalTSD(tsdGlobal.key); ClientData resultPtr = NULL; TSDUnion *keyPtr = (TSDUnion *) dataKeyPtr; sig_atomic_t offset = keyPtr->offset; @@ -223,12 +223,12 @@ TclThreadStorageKeySet( Tcl_ThreadDataKey *dataKeyPtr, void *value) { - TSDTable *tsdTablePtr = (TSDTable *)TclpThreadGetMasterTSD(tsdMaster.key); + TSDTable *tsdTablePtr = (TSDTable *)TclpThreadGetGlobalTSD(tsdGlobal.key); TSDUnion *keyPtr = (TSDUnion *) dataKeyPtr; if (tsdTablePtr == NULL) { tsdTablePtr = TSDTableCreate(); - TclpThreadSetMasterTSD(tsdMaster.key, tsdTablePtr); + TclpThreadSetGlobalTSD(tsdGlobal.key, tsdTablePtr); } /* @@ -240,15 +240,15 @@ TclThreadStorageKeySet( */ if (keyPtr->offset == 0) { - Tcl_MutexLock(&tsdMaster.mutex); + Tcl_MutexLock(&tsdGlobal.mutex); if (keyPtr->offset == 0) { /* * The Tcl_ThreadDataKey hasn't been used yet. Make a new one. */ - keyPtr->offset = ++tsdMaster.counter; + keyPtr->offset = ++tsdGlobal.counter; } - Tcl_MutexUnlock(&tsdMaster.mutex); + Tcl_MutexUnlock(&tsdGlobal.mutex); } /* @@ -288,11 +288,11 @@ TclThreadStorageKeySet( void TclFinalizeThreadDataThread(void) { - TSDTable *tsdTablePtr = (TSDTable *)TclpThreadGetMasterTSD(tsdMaster.key); + TSDTable *tsdTablePtr = (TSDTable *)TclpThreadGetGlobalTSD(tsdGlobal.key); if (tsdTablePtr != NULL) { TSDTableDelete(tsdTablePtr); - TclpThreadSetMasterTSD(tsdMaster.key, NULL); + TclpThreadSetGlobalTSD(tsdGlobal.key, NULL); } } @@ -316,7 +316,7 @@ TclFinalizeThreadDataThread(void) void TclInitThreadStorage(void) { - tsdMaster.key = TclpThreadCreateKey(); + tsdGlobal.key = TclpThreadCreateKey(); } /* @@ -339,8 +339,8 @@ TclInitThreadStorage(void) void TclFinalizeThreadStorage(void) { - TclpThreadDeleteKey(tsdMaster.key); - tsdMaster.key = NULL; + TclpThreadDeleteKey(tsdGlobal.key); + tsdGlobal.key = NULL; } #else /* !TCL_THREADS */ diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 8a995e5..5b296f0 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -4364,8 +4364,8 @@ TclGetProcessGlobalValue( if (pgvPtr->encoding != current) { /* - * The system encoding has changed since the master string value - * was saved. Convert the master value to be based on the new + * The system encoding has changed since the global string value + * was saved. Convert the global value to be based on the new * system encoding. */ diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl index e4edfda..c894ff1 100644 --- a/library/tcltest/tcltest.tcl +++ b/library/tcltest/tcltest.tcl @@ -811,14 +811,14 @@ namespace eval tcltest { trace add variable Option(-errfile) write \ [namespace code {errorChannel $Option(-errfile) ;#}] - proc loadIntoSlaveInterpreter {slave args} { + proc loadIntoChildInterpreter {child args} { variable Version - interp eval $slave [package ifneeded tcltest $Version] - interp eval $slave "tcltest::configure {*}{$args}" - interp alias $slave ::tcltest::ReportToMaster \ - {} ::tcltest::ReportedFromSlave + interp eval $child [package ifneeded tcltest $Version] + interp eval $child "tcltest::configure {*}{$args}" + interp alias $child ::tcltest::ReportToParent \ + {} ::tcltest::ReportedFromChild } - proc ReportedFromSlave {total passed skipped failed because newfiles} { + proc ReportedFromChild {total passed skipped failed because newfiles} { variable numTests variable skippedBecause variable createdNewFiles @@ -2462,8 +2462,8 @@ proc tcltest::cleanupTests {{calledFromAllFile 0}} { set testFileName [file tail [info script]] # Hook to handle reporting to a parent interpreter - if {[llength [info commands [namespace current]::ReportToMaster]]} { - ReportToMaster $numTests(Total) $numTests(Passed) $numTests(Skipped) \ + if {[llength [info commands [namespace current]::ReportToParent]]} { + ReportToParent $numTests(Total) $numTests(Passed) $numTests(Skipped) \ $numTests(Failed) [array get skippedBecause] \ [array get createdNewFiles] set testSingleFile false diff --git a/tests/chanio.test b/tests/chanio.test index 975160c..912b568 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -6371,7 +6371,7 @@ test chan-io-49.5 {testing crlf reading, leftover cr disgorgment} -setup { test chan-io-50.1 {testing handler deletion} -setup { file delete $path(test1) -} -constraints {testchannelevent} -body { +} -constraints {testchannelevent nonPortable} -body { set f [open $path(test1) w] chan close $f set f [open $path(test1) r] @@ -6389,7 +6389,7 @@ test chan-io-50.2 {testing handler deletion with multiple handlers} -setup { file delete $path(test1) chan close [open $path(test1) w] set z "" -} -constraints {testchannelevent} -body { +} -constraints {testchannelevent nonPortable} -body { set f [open $path(test1) r] testchannelevent $f add readable [namespace code [list delhandler $f 1]] testchannelevent $f add readable [namespace code [list delhandler $f 0]] @@ -6408,7 +6408,7 @@ test chan-io-50.3 {testing handler deletion with multiple handlers} -setup { file delete $path(test1) chan close [open $path(test1) w] set z "" -} -constraints {testchannelevent} -body { +} -constraints {testchannelevent nonPortable} -body { set f [open $path(test1) r] testchannelevent $f add readable [namespace code [list notcalled $f 1]] testchannelevent $f add readable [namespace code [list delhandler $f 0]] @@ -6434,7 +6434,7 @@ test chan-io-50.4 {testing handler deletion vs reentrant calls} -setup { file delete $path(test1) set f [open $path(test1) w] chan close $f -} -constraints {testchannelevent} -body { +} -constraints {testchannelevent nonPortable} -body { set f [open $path(test1) r] testchannelevent $f add readable [namespace code { if {$u eq "recursive"} { @@ -6457,7 +6457,7 @@ test chan-io-50.5 {testing handler deletion vs reentrant calls} -setup { file delete $path(test1) set f [open $path(test1) w] chan close $f -} -constraints {testchannelevent} -body { +} -constraints {testchannelevent nonPortable} -body { set f [open $path(test1) r] testchannelevent $f add readable [namespace code [list notcalled $f]] testchannelevent $f add readable [namespace code [list del $f]] @@ -6492,7 +6492,7 @@ test chan-io-50.6 {testing handler deletion vs reentrant calls} -setup { file delete $path(test1) set f [open $path(test1) w] chan close $f -} -constraints {testchannelevent} -body { +} -constraints {testchannelevent nonPortable} -body { set f [open $path(test1) r] testchannelevent $f add readable [namespace code [list second $f]] testchannelevent $f add readable [namespace code [list first $f]] diff --git a/tests/event.test b/tests/event.test index 5c111f8..5984527 100644 --- a/tests/event.test +++ b/tests/event.test @@ -27,7 +27,7 @@ testConstraint exec [llength [info commands exec]] test event-1.1 {Tcl_CreateFileHandler, reading} -setup { testfilehandler close set result "" -} -constraints {testfilehandler} -body { +} -constraints {testfilehandler nonPortable} -body { testfilehandler create 0 readable off testfilehandler clear 0 testfilehandler oneevent diff --git a/tests/init.test b/tests/init.test index a241c0b..91df4a1 100644 --- a/tests/init.test +++ b/tests/init.test @@ -19,16 +19,16 @@ if {"::tcltest" ni [namespace children]} { catch {namespace delete {*}[namespace children :: test_ns_*]} test init-0.1 {no error on initialization phase (init.tcl)} -setup { - interp create slave + interp create child } -body { - slave eval { + child eval { list [set v [info exists ::errorInfo]] \ [if {$v} {set ::errorInfo}] \ [set v [info exists ::errorCode]] \ [if {$v} {set ::errorCode}] } } -cleanup { - interp delete slave + interp delete child } -result {0 {} 0 {}} # Six cases - white box testing @@ -59,11 +59,11 @@ test init-1.8 {auto_qualify - multiple colons 2} { auto_qualify :::foo ::bar } foo -# We use a sub-interp and auto_reset and double the tests because there is 2 +# We use a child interp and auto_reset and double the tests because there is 2 # places where auto_loading occur (before loading the indexes files and after) set testInterp [interp create] -tcltest::loadIntoSlaveInterpreter $testInterp {*}$argv +tcltest::loadIntoChildInterpreter $testInterp {*}$argv interp eval $testInterp { namespace import -force ::tcltest::* customMatch pairwise {apply {{mode pair} { diff --git a/tests/io.test b/tests/io.test index 96add20..1137878 100644 --- a/tests/io.test +++ b/tests/io.test @@ -6783,7 +6783,7 @@ test io-49.5 {testing crlf reading, leftover cr disgorgment} { set l } [list 7 a\rb\rc 7 {} 7 1] -test io-50.1 {testing handler deletion} {testchannelevent} { +test io-50.1 {testing handler deletion} {testchannelevent nonPortable} { file delete $path(test1) set f [open $path(test1) w] close $f @@ -6799,7 +6799,7 @@ test io-50.1 {testing handler deletion} {testchannelevent} { close $f set z } called -test io-50.2 {testing handler deletion with multiple handlers} {testchannelevent} { +test io-50.2 {testing handler deletion with multiple handlers} {testchannelevent nonPortable} { file delete $path(test1) set f [open $path(test1) w] close $f @@ -6817,7 +6817,7 @@ test io-50.2 {testing handler deletion with multiple handlers} {testchannelevent string compare [string tolower $z] \ [list [list called delhandler $f 0] [list called delhandler $f 1]] } 0 -test io-50.3 {testing handler deletion with multiple handlers} {testchannelevent} { +test io-50.3 {testing handler deletion with multiple handlers} {testchannelevent nonPortable} { file delete $path(test1) set f [open $path(test1) w] close $f @@ -6843,7 +6843,7 @@ test io-50.3 {testing handler deletion with multiple handlers} {testchannelevent [list [list delhandler $f 0 called] \ [list delhandler $f 0 deleted myself]] } 0 -test io-50.4 {testing handler deletion vs reentrant calls} {testchannelevent} { +test io-50.4 {testing handler deletion vs reentrant calls} {testchannelevent nonPortable} { file delete $path(test1) set f [open $path(test1) w] close $f @@ -6865,10 +6865,9 @@ test io-50.4 {testing handler deletion vs reentrant calls} {testchannelevent} { variable z "" update close $f - string compare [string tolower $z] \ - {{delrecursive calling recursive} {delrecursive deleting recursive}} -} 0 -test io-50.5 {testing handler deletion vs reentrant calls} {testchannelevent} { + set z +} {{delrecursive calling recursive} {delrecursive deleting recursive}} +test io-50.5 {testing handler deletion vs reentrant calls} {testchannelevent nonPortable} { file delete $path(test1) set f [open $path(test1) w] close $f @@ -6898,11 +6897,10 @@ test io-50.5 {testing handler deletion vs reentrant calls} {testchannelevent} { set u toplevel update close $f - string compare [string tolower $z] \ - [list {del calling recursive} {del deleted notcalled} \ - {del deleted myself} {del after update}] -} 0 -test io-50.6 {testing handler deletion vs reentrant calls} {testchannelevent} { + set z +} [list {del calling recursive} {del deleted notcalled} \ + {del deleted myself} {del after update}] +test io-50.6 {testing handler deletion vs reentrant calls} {testchannelevent nonPortable} { file delete $path(test1) set f [open $path(test1) w] close $f @@ -6940,11 +6938,10 @@ test io-50.6 {testing handler deletion vs reentrant calls} {testchannelevent} { set u toplevel update close $f - string compare [string tolower $z] \ - [list {first called} {first called not toplevel} \ - {second called, first time} {second called, second time} \ - {first after update}] -} 0 + set z +} [list {first called} {first called not toplevel} \ + {second called, first time} {second called, second time} \ + {first after update}] test io-51.1 {Test old socket deletion on Macintosh} {socket} { set x 0 diff --git a/tests/package.test b/tests/package.test index 2dca06b..e12dd30 100644 --- a/tests/package.test +++ b/tests/package.test @@ -20,9 +20,9 @@ if {"::tcltest" ni [namespace children]} { ::tcltest::loadTestedCommands catch [list package require -exact Tcltest [info patchlevel]] -# Do all this in a slave interp to avoid garbaging the package list +# Do all this in a child interp to avoid garbaging the package list set i [interp create] -tcltest::loadIntoSlaveInterpreter $i {*}$argv +tcltest::loadIntoChildInterpreter $i {*}$argv catch [list load {} Tcltest $i] interp eval $i { namespace import -force ::tcltest::* @@ -945,15 +945,15 @@ test package-4.56 {Tcl_PackageCmd procedure, "vsatisfies" option} -body { # No tests for FindPackage; can't think up anything detectable errors. test package-5.1 {TclFreePackageInfo procedure} { - interp create slave - slave eval { + interp create child + child eval { package ifneeded t 2.3 x package ifneeded t 2.4 y package ifneeded x 3.1 z package provide q 4.3 package unknown "will this get freed?" } - interp delete slave + interp delete child } {} test package-5.2 {TclFreePackageInfo procedure} -body { interp create foo diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index 795c62c..7907732 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -169,12 +169,12 @@ static Tcl_ThreadDataKey dataKey; #endif /* TCL_NO_DEPRECATED */ /* - * masterLock is used to serialize creation of mutexes, condition variables, + * globalLock is used to serialize creation of mutexes, condition variables, * and thread local storage. This is the only place that can count on the * ability to statically initialize the mutex. */ -static pthread_mutex_t masterLock = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t globalLock = PTHREAD_MUTEX_INITIALIZER; /* * initLock is used to serialize initialization and finalization of Tcl. It @@ -423,7 +423,7 @@ TclFinalizeLock(void) /* * You do not need to destroy mutexes that were created with the * PTHREAD_MUTEX_INITIALIZER macro. These mutexes do not need any - * destruction: masterLock, allocLock, and initLock. + * destruction: globalLock, allocLock, and initLock. */ pthread_mutex_unlock(&initLock); @@ -458,7 +458,7 @@ TclpInitUnlock(void) /* *---------------------------------------------------------------------- * - * TclpMasterLock + * TclpGlobalLock * * This procedure is used to grab a lock that serializes creation and * finalization of serialization objects. This interface is only needed @@ -471,23 +471,23 @@ TclpInitUnlock(void) * None. * * Side effects: - * Acquire the master mutex. + * Acquire the global mutex. * *---------------------------------------------------------------------- */ void -TclpMasterLock(void) +TclpGlobalLock(void) { #if TCL_THREADS - pthread_mutex_lock(&masterLock); + pthread_mutex_lock(&globalLock); #endif } /* *---------------------------------------------------------------------- * - * TclpMasterUnlock + * TclpGlobalUnlock * * This procedure is used to release a lock that serializes creation and * finalization of synchronization objects. @@ -496,16 +496,16 @@ TclpMasterLock(void) * None. * * Side effects: - * Release the master mutex. + * Release the global mutex. * *---------------------------------------------------------------------- */ void -TclpMasterUnlock(void) +TclpGlobalUnlock(void) { #if TCL_THREADS - pthread_mutex_unlock(&masterLock); + pthread_mutex_unlock(&globalLock); #endif } @@ -571,10 +571,10 @@ Tcl_MutexLock( PMutex *pmutexPtr; if (*mutexPtr == NULL) { - pthread_mutex_lock(&masterLock); + pthread_mutex_lock(&globalLock); if (*mutexPtr == NULL) { /* - * Double inside master lock check to avoid a race condition. + * Double inside global lock check to avoid a race condition. */ pmutexPtr = (PMutex *)ckalloc(sizeof(PMutex)); @@ -582,7 +582,7 @@ Tcl_MutexLock( *mutexPtr = (Tcl_Mutex) pmutexPtr; TclRememberMutex(mutexPtr); } - pthread_mutex_unlock(&masterLock); + pthread_mutex_unlock(&globalLock); } pmutexPtr = *((PMutex **) mutexPtr); PMutexLock(pmutexPtr); @@ -622,7 +622,7 @@ Tcl_MutexUnlock( * This procedure is invoked to clean up one mutex. This is only safe to * call at the end of time. * - * This assumes the Master Lock is held. + * This assumes the Global Lock is held. * * Results: * None. @@ -679,7 +679,7 @@ Tcl_ConditionWait( struct timespec ptime; if (*condPtr == NULL) { - pthread_mutex_lock(&masterLock); + pthread_mutex_lock(&globalLock); /* * Double check inside mutex to avoid race, then initialize condition @@ -692,7 +692,7 @@ Tcl_ConditionWait( *condPtr = (Tcl_Condition) pcondPtr; TclRememberCondition(condPtr); } - pthread_mutex_unlock(&masterLock); + pthread_mutex_unlock(&globalLock); } pmutexPtr = *((PMutex **) mutexPtr); pcondPtr = *((pthread_cond_t **) condPtr); @@ -756,7 +756,7 @@ Tcl_ConditionNotify( * This procedure is invoked to clean up a condition variable. This is * only safe to call at the end of time. * - * This assumes the Master Lock is held. + * This assumes the Global Lock is held. * * Results: * None. @@ -943,19 +943,19 @@ TclpThreadDeleteKey( } void -TclpThreadSetMasterTSD( +TclpThreadSetGlobalTSD( void *tsdKeyPtr, void *ptr) { pthread_key_t *ptkeyPtr = (pthread_key_t *)tsdKeyPtr; if (pthread_setspecific(*ptkeyPtr, ptr)) { - Tcl_Panic("unable to set master TSD value"); + Tcl_Panic("unable to set global TSD value"); } } void * -TclpThreadGetMasterTSD( +TclpThreadGetGlobalTSD( void *tsdKeyPtr) { pthread_key_t *ptkeyPtr = (pthread_key_t*)tsdKeyPtr; diff --git a/win/tclWinNotify.c b/win/tclWinNotify.c index 2ab4efa..7d5249d 100644 --- a/win/tclWinNotify.c +++ b/win/tclWinNotify.c @@ -84,12 +84,12 @@ Tcl_InitNotifier(void) } else { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - TclpMasterLock(); + TclpGlobalLock(); if (!initialized) { initialized = 1; InitializeCriticalSection(¬ifierMutex); } - TclpMasterUnlock(); + TclpGlobalUnlock(); /* * Register Notifier window class if this is the first thread to use diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index 89f2b12..abd4f84 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -22,15 +22,15 @@ _CRTIMP unsigned int __cdecl _controlfp (unsigned int unNew, unsigned int unMask #endif /* - * This is the master lock used to serialize access to other serialization + * This is the global lock used to serialize access to other serialization * data structures. */ -static CRITICAL_SECTION masterLock; +static CRITICAL_SECTION globalLock; static int initialized = 0; /* - * This is the master lock used to serialize initialization and finalization + * This is the global lock used to serialize initialization and finalization * of Tcl as a whole. */ @@ -362,7 +362,7 @@ TclpInitLock(void) initialized = 1; InitializeCriticalSection(&joinLock); InitializeCriticalSection(&initLock); - InitializeCriticalSection(&masterLock); + InitializeCriticalSection(&globalLock); } EnterCriticalSection(&initLock); } @@ -393,7 +393,7 @@ TclpInitUnlock(void) /* *---------------------------------------------------------------------- * - * TclpMasterLock + * TclpGlobalLock * * This procedure is used to grab a lock that serializes creation of * mutexes, condition variables, and thread local storage keys. @@ -405,13 +405,13 @@ TclpInitUnlock(void) * None. * * Side effects: - * Acquire the master mutex. + * Acquire the global mutex. * *---------------------------------------------------------------------- */ void -TclpMasterLock(void) +TclpGlobalLock(void) { if (!initialized) { /* @@ -424,15 +424,15 @@ TclpMasterLock(void) initialized = 1; InitializeCriticalSection(&joinLock); InitializeCriticalSection(&initLock); - InitializeCriticalSection(&masterLock); + InitializeCriticalSection(&globalLock); } - EnterCriticalSection(&masterLock); + EnterCriticalSection(&globalLock); } /* *---------------------------------------------------------------------- * - * TclpMasterUnlock + * TclpGlobalUnlock * * This procedure is used to release a lock that serializes creation and * deletion of synchronization objects. @@ -441,15 +441,15 @@ TclpMasterLock(void) * None. * * Side effects: - * Release the master mutex. + * Release the global mutex. * *---------------------------------------------------------------------- */ void -TclpMasterUnlock(void) +TclpGlobalUnlock(void) { - LeaveCriticalSection(&masterLock); + LeaveCriticalSection(&globalLock); } /* @@ -506,14 +506,14 @@ Tcl_GetAllocMutex(void) void TclFinalizeLock(void) { - TclpMasterLock(); + TclpGlobalLock(); DeleteCriticalSection(&joinLock); /* * Destroy the critical section that we are holding! */ - DeleteCriticalSection(&masterLock); + DeleteCriticalSection(&globalLock); initialized = 0; #if TCL_THREADS @@ -561,10 +561,10 @@ Tcl_MutexLock( CRITICAL_SECTION *csPtr; if (*mutexPtr == NULL) { - TclpMasterLock(); + TclpGlobalLock(); /* - * Double inside master lock check to avoid a race. + * Double inside global lock check to avoid a race. */ if (*mutexPtr == NULL) { @@ -573,7 +573,7 @@ Tcl_MutexLock( *mutexPtr = (Tcl_Mutex)csPtr; TclRememberMutex(mutexPtr); } - TclpMasterUnlock(); + TclpGlobalUnlock(); } csPtr = *((CRITICAL_SECTION **)mutexPtr); EnterCriticalSection(csPtr); @@ -675,7 +675,7 @@ Tcl_ConditionWait( */ if (tsdPtr->flags == WIN_THREAD_UNINIT) { - TclpMasterLock(); + TclpGlobalLock(); /* * Create the per-thread event and queue pointers. @@ -689,14 +689,14 @@ Tcl_ConditionWait( tsdPtr->flags = WIN_THREAD_RUNNING; doExit = 1; } - TclpMasterUnlock(); + TclpGlobalUnlock(); if (doExit) { /* * Create a per-thread exit handler to clean up the condEvent. We - * must be careful to do this outside the Master Lock because + * must be careful to do this outside the Global Lock because * Tcl_CreateThreadExitHandler uses its own ThreadSpecificData, - * and initializing that may drop back into the Master Lock. + * and initializing that may drop back into the Global Lock. */ Tcl_CreateThreadExitHandler(FinalizeConditionEvent, tsdPtr); @@ -704,7 +704,7 @@ Tcl_ConditionWait( } if (*condPtr == NULL) { - TclpMasterLock(); + TclpGlobalLock(); /* * Initialize the per-condition queue pointers and Mutex. @@ -718,7 +718,7 @@ Tcl_ConditionWait( *condPtr = (Tcl_Condition) winCondPtr; TclRememberCondition(condPtr); } - TclpMasterUnlock(); + TclpGlobalUnlock(); } csPtr = *((CRITICAL_SECTION **)mutexPtr); winCondPtr = *((WinCondition **)condPtr); @@ -896,7 +896,7 @@ FinalizeConditionEvent( * This procedure is invoked to clean up a condition variable. This is * only safe to call at the end of time. * - * This assumes the Master Lock is held. + * This assumes the Global Lock is held. * * Results: * None. @@ -1065,19 +1065,19 @@ TclpThreadDeleteKey( } void -TclpThreadSetMasterTSD( +TclpThreadSetGlobalTSD( void *tsdKeyPtr, void *ptr) { DWORD *key = (DWORD *)tsdKeyPtr; if (!TlsSetValue(*key, ptr)) { - Tcl_Panic("unable to set master TSD value"); + Tcl_Panic("unable to set global TSD value"); } } void * -TclpThreadGetMasterTSD( +TclpThreadGetGlobalTSD( void *tsdKeyPtr) { DWORD *key = (DWORD *)tsdKeyPtr; |