- 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:
Andi Gutmans 2001-04-04 21:43:04 +00:00
parent cc48dd2138
commit 6123fe515d

View File

@ -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;