summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixThrd.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix/tclUnixThrd.c')
-rw-r--r--unix/tclUnixThrd.c80
1 files changed, 40 insertions, 40 deletions
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c
index 054a5d2..92399f4 100644
--- a/unix/tclUnixThrd.c
+++ b/unix/tclUnixThrd.c
@@ -169,23 +169,23 @@ 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
- * cannot use any dyamically allocated storage.
+ * cannot use any dynamically allocated storage.
*/
static pthread_mutex_t initLock = PTHREAD_MUTEX_INITIALIZER;
/*
* allocLock is used by Tcl's version of malloc for synchronization. For
- * obvious reasons, cannot use any dyamically allocated storage.
+ * obvious reasons, cannot use any dynamically allocated storage.
*/
static PMutex allocLock;
@@ -236,7 +236,7 @@ TclpThreadCreate(
#ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE
if (stackSize != TCL_THREAD_STACK_DEFAULT) {
- pthread_attr_setstacksize(&attr, (size_t) stackSize);
+ pthread_attr_setstacksize(&attr, stackSize);
#ifdef TCL_THREAD_STACK_MIN
} else {
/*
@@ -266,12 +266,12 @@ TclpThreadCreate(
}
if (pthread_create(&theThread, &attr,
- (void * (*)(void *))(void *)proc, (void *) clientData) &&
+ (void * (*)(void *))(void *)proc, (void *)clientData) &&
pthread_create(&theThread, NULL,
- (void * (*)(void *))(void *)proc, (void *) clientData)) {
+ (void * (*)(void *))(void *)proc, (void *)clientData)) {
result = TCL_ERROR;
} else {
- *idPtr = (Tcl_ThreadId) theThread;
+ *idPtr = (Tcl_ThreadId)theThread;
result = TCL_OK;
}
pthread_attr_destroy(&attr);
@@ -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
}
@@ -515,7 +515,7 @@ TclpMasterUnlock(void)
* Tcl_GetAllocMutex
*
* This procedure returns a pointer to a statically initialized mutex for
- * use by the memory allocator. The alloctor must use this lock, because
+ * use by the memory allocator. The allocator must use this lock, because
* all other locks are allocated...
*
* Results:
@@ -571,18 +571,18 @@ 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 = ckalloc(sizeof(PMutex));
+ pmutexPtr = (PMutex *)ckalloc(sizeof(PMutex));
PMutexInit(pmutexPtr);
*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
@@ -687,15 +687,15 @@ Tcl_ConditionWait(
*/
if (*condPtr == NULL) {
- pcondPtr = ckalloc(sizeof(pthread_cond_t));
+ pcondPtr = (pthread_cond_t *)ckalloc(sizeof(pthread_cond_t));
pthread_cond_init(pcondPtr, NULL);
*condPtr = (Tcl_Condition) pcondPtr;
TclRememberCondition(condPtr);
}
- pthread_mutex_unlock(&masterLock);
+ pthread_mutex_unlock(&globalLock);
}
- pmutexPtr = *((PMutex **) mutexPtr);
- pcondPtr = *((pthread_cond_t **) condPtr);
+ pmutexPtr = *((PMutex **)mutexPtr);
+ pcondPtr = *((pthread_cond_t **)condPtr);
if (timePtr == NULL) {
PCondWait(pcondPtr, pmutexPtr);
} else {
@@ -737,7 +737,7 @@ void
Tcl_ConditionNotify(
Tcl_Condition *condPtr)
{
- pthread_cond_t *pcondPtr = *((pthread_cond_t **) condPtr);
+ pthread_cond_t *pcondPtr = *((pthread_cond_t **)condPtr);
if (pcondPtr != NULL) {
pthread_cond_broadcast(pcondPtr);
@@ -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.
@@ -771,7 +771,7 @@ void
TclpFinalizeCondition(
Tcl_Condition *condPtr)
{
- pthread_cond_t *pcondPtr = *(pthread_cond_t **) condPtr;
+ pthread_cond_t *pcondPtr = *(pthread_cond_t **)condPtr;
if (pcondPtr != NULL) {
pthread_cond_destroy(pcondPtr);
@@ -846,7 +846,7 @@ TclpNewAllocMutex(void)
AllocMutex *lockPtr;
PMutex *plockPtr;
- lockPtr = malloc(sizeof(AllocMutex));
+ lockPtr = (AllocMutex *)malloc(sizeof(AllocMutex));
if (lockPtr == NULL) {
Tcl_Panic("could not allocate lock");
}
@@ -860,7 +860,7 @@ void
TclpFreeAllocMutex(
Tcl_Mutex *mutex) /* The alloc mutex to free. */
{
- AllocMutex *lockPtr = (AllocMutex *) mutex;
+ AllocMutex *lockPtr = (AllocMutex *)mutex;
if (!lockPtr) {
return;
@@ -917,7 +917,7 @@ TclpThreadCreateKey(void)
{
pthread_key_t *ptkeyPtr;
- ptkeyPtr = TclpSysAlloc(sizeof(pthread_key_t), 0);
+ ptkeyPtr = (pthread_key_t *)TclpSysAlloc(sizeof(pthread_key_t), 0);
if (NULL == ptkeyPtr) {
Tcl_Panic("unable to allocate thread key!");
}
@@ -933,7 +933,7 @@ void
TclpThreadDeleteKey(
void *keyPtr)
{
- pthread_key_t *ptkeyPtr = keyPtr;
+ pthread_key_t *ptkeyPtr = (pthread_key_t *)keyPtr;
if (pthread_key_delete(*ptkeyPtr)) {
Tcl_Panic("unable to delete key!");
@@ -943,22 +943,22 @@ TclpThreadDeleteKey(
}
void
-TclpThreadSetMasterTSD(
+TclpThreadSetGlobalTSD(
void *tsdKeyPtr,
void *ptr)
{
- pthread_key_t *ptkeyPtr = tsdKeyPtr;
+ 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 = tsdKeyPtr;
+ pthread_key_t *ptkeyPtr = (pthread_key_t *)tsdKeyPtr;
return pthread_getspecific(*ptkeyPtr);
}