aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-06-06 23:10:37 -0700
committerChris Robinson <[email protected]>2018-06-06 23:10:37 -0700
commitbd9c6989c20ea40cc12dd54105ec708c4b28beaa (patch)
tree3e70d5732633e270b54205c58936b7239bdbe882 /common
parent72e4b603747124b398448cf3b408d09ff0544015 (diff)
Clear the TLS pointer after running its destructor callback
Diffstat (limited to 'common')
-rw-r--r--common/threads.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/common/threads.c b/common/threads.c
index 2655a244..6cfe383b 100644
--- a/common/threads.c
+++ b/common/threads.c
@@ -428,7 +428,11 @@ void althrd_thread_detach(void)
{
void *ptr = altss_get(TlsDestructors.keys[i]);
altss_dtor_t callback = (altss_dtor_t)TlsDestructors.values[i];
- if(ptr && callback) callback(ptr);
+ if(ptr)
+ {
+ if(callback) callback(ptr);
+ altss_set(TlsDestructors.keys[i], NULL);
+ }
}
UnlockUIntMapRead(&TlsDestructors);
}