diff options
Diffstat (limited to 'exit.c')
-rw-r--r-- | exit.c | 24 |
1 files changed, 8 insertions, 16 deletions
@@ -6,37 +6,29 @@ * a thread. */ +#include <windows.h> +#include <process.h> #include "pthread.h" +#include "implement.h" void pthread_exit(void * value) { - /* The semantics are such that additional tasks must be done for - strict POSIX conformance. We must add code here later which - deals with executing cleanup handlers and such. For now, the - following is mostly correct: */ int t; t = _pthread_getthreadindex(pthread_self()); - handler = _pthread_threads_table[t]->cleanupstack->first; /* Run all the cleanup handlers */ - while (handler != NULL) { - void (* func)(void *); - void * arg; - _pthread_cleanup_node_t * next; - - func = handler->routine; - arg = handler->arg; - _pthread_threads_table[t]->cleanupstack->first = next = handler->next; - free(handler); - (void) func(arg); - } + _pthread_do_cancellation(t); /* CRITICAL SECTION */ pthread_mutex_lock(&_pthread_count_mutex); + + /* Frees attr and cleanupstack */ free(_pthread_threads_table[t]->attr); + _pthread_threads_table[t]->thread = NULL; + pthread_mutex_unlock(&_pthread_count_mutex); /* END CRITICAL SECTION */ |