diff options
Diffstat (limited to 'unix/tclUnixThrd.c')
-rw-r--r-- | unix/tclUnixThrd.c | 168 |
1 files changed, 0 insertions, 168 deletions
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index bb07c24..3d068e5 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -543,174 +543,6 @@ TclpFinalizeMutex(mutexPtr) *mutexPtr = NULL; } } - - -/* - *---------------------------------------------------------------------- - * - * TclpThreadDataKeyInit -- - * - * This procedure initializes a thread specific data block key. Each - * thread has table of pointers to thread specific data. All threads - * agree on which table entry is used by each module. This is remembered - * in a "data key", that is just an index into this table. To allow self - * initialization, the interface passes a pointer to this key and the - * first thread to use the key fills in the pointer to the key. The key - * should be a process-wide static. - * - * Results: - * None. - * - * Side effects: - * Will allocate memory the first time this process calls for this key. - * In this case it modifies its argument to hold the pointer to - * information about the key. - * - *---------------------------------------------------------------------- - */ - -void -TclpThreadDataKeyInit(keyPtr) - Tcl_ThreadDataKey *keyPtr; /* Identifier for the data chunk, - * really (pthread_key_t **) */ -{ - pthread_key_t *pkeyPtr; - - MASTER_LOCK; - if (*keyPtr == NULL) { - pkeyPtr = (pthread_key_t *) ckalloc(sizeof(pthread_key_t)); - pthread_key_create(pkeyPtr, NULL); - *keyPtr = (Tcl_ThreadDataKey)pkeyPtr; - TclRememberDataKey(keyPtr); - } - MASTER_UNLOCK; -} - -/* - *---------------------------------------------------------------------- - * - * TclpThreadDataKeyGet -- - * - * This procedure returns a pointer to a block of thread local storage. - * - * Results: - * A thread-specific pointer to the data structure, or NULL if the memory - * has not been assigned to this key for this thread. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -VOID * -TclpThreadDataKeyGet(keyPtr) - Tcl_ThreadDataKey *keyPtr; /* Identifier for the data chunk, really - * (pthread_key_t **) */ -{ - pthread_key_t *pkeyPtr = *(pthread_key_t **)keyPtr; - if (pkeyPtr == NULL) { - return NULL; - } else { - return (VOID *)pthread_getspecific(*pkeyPtr); - } -} - - -/* - *---------------------------------------------------------------------- - * - * TclpThreadDataKeySet -- - * - * This procedure sets the pointer to a block of thread local storage. - * - * Results: - * None. - * - * Side effects: - * Sets up the thread so future calls to TclpThreadDataKeyGet with this - * key will return the data pointer. - * - *---------------------------------------------------------------------- - */ - -void -TclpThreadDataKeySet(keyPtr, data) - Tcl_ThreadDataKey *keyPtr; /* Identifier for the data chunk, really - * (pthread_key_t **) */ - VOID *data; /* Thread local storage */ -{ - pthread_key_t *pkeyPtr = *(pthread_key_t **)keyPtr; - pthread_setspecific(*pkeyPtr, data); -} - -/* - *---------------------------------------------------------------------- - * - * TclpFinalizeThreadData -- - * - * This procedure cleans up the thread-local storage. This is called once - * for each thread. - * - * Results: - * None. - * - * Side effects: - * Frees up all thread local storage. - * - *---------------------------------------------------------------------- - */ - -void -TclpFinalizeThreadData(keyPtr) - Tcl_ThreadDataKey *keyPtr; -{ - VOID *result; - pthread_key_t *pkeyPtr; - - if (*keyPtr != NULL) { - pkeyPtr = *(pthread_key_t **)keyPtr; - result = (VOID *)pthread_getspecific(*pkeyPtr); - if (result != NULL) { - ckfree((char *)result); - pthread_setspecific(*pkeyPtr, (void *)NULL); - } - } -} - -/* - *---------------------------------------------------------------------- - * - * TclpFinalizeThreadDataKey -- - * - * This procedure is invoked to clean up one key. This is a process-wide - * storage identifier. The thread finalization code cleans up the thread - * local storage itself. - * - * This assumes the master lock is held. - * - * Results: - * None. - * - * Side effects: - * The key is deallocated. - * - *---------------------------------------------------------------------- - */ - -void -TclpFinalizeThreadDataKey(keyPtr) - Tcl_ThreadDataKey *keyPtr; -{ - pthread_key_t *pkeyPtr; - if (*keyPtr != NULL) { - pkeyPtr = *(pthread_key_t **)keyPtr; - pthread_key_delete(*pkeyPtr); - ckfree((char *)pkeyPtr); - *keyPtr = NULL; - } -} - /* *---------------------------------------------------------------------- |