summaryrefslogtreecommitdiff
path: root/pthread_key_delete.c
diff options
context:
space:
mode:
authorrpj <rpj>2004-05-17 01:38:02 +0000
committerrpj <rpj>2004-05-17 01:38:02 +0000
commit771465fed0cf50ee2dd790723245fc091699c324 (patch)
treed8c18d095a33fe7c4564bd90c5f313bb9e4057dd /pthread_key_delete.c
parent8b14911744f58cbe3730703f3fcc41cd969fd0f3 (diff)
re-indentation, bug fixes, hooks for pre-emptive async cancelation
Diffstat (limited to 'pthread_key_delete.c')
-rw-r--r--pthread_key_delete.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/pthread_key_delete.c b/pthread_key_delete.c
index 4f5064e..2bb2209 100644
--- a/pthread_key_delete.c
+++ b/pthread_key_delete.c
@@ -71,51 +71,51 @@ pthread_key_delete (pthread_key_t key)
if (key != NULL)
{
if (key->threads != NULL &&
- key->destructor != NULL &&
- pthread_mutex_lock (&(key->threadsLock)) == 0)
- {
- /*
- * Run through all Thread<-->Key associations
- * for this key.
- * If the pthread_t still exists (ie the assoc->thread
- * is not NULL) then leave the assoc for the thread to
- * destroy.
- * Notes:
- * If assoc->thread is NULL, then the associated thread
- * is no longer referencing this assoc.
- * The association is only referenced
- * by this key and must be released; otherwise
- * the assoc will be destroyed when the thread is destroyed.
- */
- ThreadKeyAssoc *assoc;
+ key->destructor != NULL &&
+ pthread_mutex_lock (&(key->threadsLock)) == 0)
+ {
+ /*
+ * Run through all Thread<-->Key associations
+ * for this key.
+ * If the pthread_t still exists (ie the assoc->thread
+ * is not NULL) then leave the assoc for the thread to
+ * destroy.
+ * Notes:
+ * If assoc->thread is NULL, then the associated thread
+ * is no longer referencing this assoc.
+ * The association is only referenced
+ * by this key and must be released; otherwise
+ * the assoc will be destroyed when the thread is destroyed.
+ */
+ ThreadKeyAssoc *assoc;
- assoc = (ThreadKeyAssoc *) key->threads;
+ assoc = (ThreadKeyAssoc *) key->threads;
- while (assoc != NULL)
- {
- if (pthread_mutex_lock (&(assoc->lock)) == 0)
- {
- ThreadKeyAssoc *next;
+ while (assoc != NULL)
+ {
+ if (pthread_mutex_lock (&(assoc->lock)) == 0)
+ {
+ ThreadKeyAssoc *next;
- assoc->key = NULL;
- next = assoc->nextThread;
- assoc->nextThread = NULL;
+ assoc->key = NULL;
+ next = assoc->nextThread;
+ assoc->nextThread = NULL;
- pthread_mutex_unlock (&(assoc->lock));
+ pthread_mutex_unlock (&(assoc->lock));
- ptw32_tkAssocDestroy (assoc);
+ ptw32_tkAssocDestroy (assoc);
- assoc = next;
- }
- }
- pthread_mutex_unlock (&(key->threadsLock));
- }
+ assoc = next;
+ }
+ }
+ pthread_mutex_unlock (&(key->threadsLock));
+ }
TlsFree (key->key);
if (key->destructor != NULL)
- {
- pthread_mutex_destroy (&(key->threadsLock));
- }
+ {
+ pthread_mutex_destroy (&(key->threadsLock));
+ }
#if defined( _DEBUG )
memset ((char *) key, 0, sizeof (*key));