diff options
Diffstat (limited to 'exit.c')
| -rw-r--r-- | exit.c | 33 | 
1 files changed, 19 insertions, 14 deletions
| @@ -12,25 +12,30 @@  #include "implement.h"  void -pthread_exit(void * value) +_pthread_vacuum(void)  { -  int t; - -  t = _pthread_getthreadindex(pthread_self()); +  /* This function can be called from pthread_exit(), or from +     _pthread_start_call() in which case cleanupstack should be +     empty but destructorstack still needs to be run. */ +  _pthread_threads_thread_t * this; -  /* Run all the cleanup handlers */ -  _pthread_do_cancellation(t); +  this = *_PTHREAD_THIS; -  /* CRITICAL SECTION */ -  pthread_mutex_lock(&_pthread_count_mutex); +  /* Run all the handlers. */ +  _pthread_handler_pop_all(&(this->cleanupstack), _PTHREAD_HANDLER_EXECUTE); +  _pthread_handler_pop_all(&(this->destructorstack), _PTHREAD_HANDLER_EXECUTE); -  /* Frees attr and cleanupstack */ -  free(_pthread_threads_table[t]->attr); +  /* Pop any atfork handlers to free storage. */ +  _pthread_handler_pop_all(&(this->forkprepare), _PTHREAD_HANDLER_NOEXECUTE); +  _pthread_handler_pop_all(&(this->forkparent), _PTHREAD_HANDLER_NOEXECUTE); +  _pthread_handler_pop_all(&(this->forkchild), _PTHREAD_HANDLER_NOEXECUTE); -  _pthread_threads_table[t]->thread = NULL; - -  pthread_mutex_unlock(&_pthread_count_mutex); -  /* END CRITICAL SECTION */ +  _pthread_delete_thread_entry(NULL); +} +void +pthread_exit(void * value) +{ +  _pthread_vacuum();    _endthreadex((DWORD) value);  } | 
