mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
- 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.
This commit is contained in:
parent
cc48dd2138
commit
6123fe515d
15
TSRM/TSRM.c
15
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;
|
||||
|
Loading…
Reference in New Issue
Block a user