summaryrefslogtreecommitdiff
path: root/TSRM
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2001-04-04 21:43:04 +0000
committerAndi Gutmans <andi@php.net>2001-04-04 21:43:04 +0000
commit6123fe515d2d237acb5f6bcd04812870ccac8de9 (patch)
tree80e72cff5c4874b065c6183f63f23fc76bf4e024 /TSRM
parentcc48dd213801878b278247be0edde00078fbebba (diff)
downloadphp-git-6123fe515d2d237acb5f6bcd04812870ccac8de9.tar.gz
- Revert previous fix because dtor's which access thread local storage
might stop working. Need to fix this! We can either mutex the whole thing which is slow (this is how it was before the race condition was introduced) or find a different solution.
Diffstat (limited to 'TSRM')
-rw-r--r--TSRM/TSRM.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c
index 1316203fc6..4425036ea7 100644
--- a/TSRM/TSRM.c
+++ b/TSRM/TSRM.c
@@ -337,11 +337,6 @@ void ts_free_thread(void)
while (thread_resources) {
if (thread_resources->thread_id == thread_id) {
- if (last) {
- last->next = thread_resources->next;
- } else {
- tsrm_tls_table[hash_value] = thread_resources->next;
- }
tsrm_mutex_unlock(tsmm_mutex);
for (i=0; i<thread_resources->count; i++) {
@@ -352,12 +347,18 @@ void ts_free_thread(void)
for (i=0; i<thread_resources->count; i++) {
free(thread_resources->storage[i]);
}
+ tsrm_mutex_lock(tsmm_mutex);
free(thread_resources->storage);
+ if (last) {
+ last->next = thread_resources->next;
+ } else {
+ tsrm_tls_table[hash_value] = thread_resources->next;
+ }
#if defined(PTHREADS)
- pthread_setspecific(tls_key, 0);
+ pthread_setspecific( tls_key, 0 );
#endif
free(thread_resources);
- return; /* Don't want to reach unlock() a second time */
+ break;
}
if (thread_resources->next) {
last = thread_resources;