diff --git a/src/system/libroot/os/thread.c b/src/system/libroot/os/thread.c index 2419ca21fc..f3b33fcfce 100644 --- a/src/system/libroot/os/thread.c +++ b/src/system/libroot/os/thread.c @@ -27,7 +27,7 @@ typedef struct callback_node { } callback_node; -void _thread_do_exit_notification(void); +void _thread_do_exit_work(void); static status_t @@ -40,14 +40,23 @@ thread_entry(thread_func entry, void* _thread) returnCode = entry(thread->entry_argument); - _thread_do_exit_notification(); + _thread_do_exit_work(); return returnCode; } +#if __GNUC__ < 3 void _thread_do_exit_notification(void) +{ + // empty stub for R5 compability +} +#endif + + +void +_thread_do_exit_work(void) { callback_node *node = tls_get(TLS_ON_EXIT_THREAD_SLOT); callback_node *next; diff --git a/src/system/libroot/posix/pthread/pthread.c b/src/system/libroot/posix/pthread/pthread.c index fe9adcd4a8..5dcabc03b3 100644 --- a/src/system/libroot/posix/pthread/pthread.c +++ b/src/system/libroot/posix/pthread/pthread.c @@ -54,10 +54,6 @@ __pthread_destroy_thread(void) { pthread_thread* thread = pthread_self(); - // check if the thread is already dead - if ((atomic_get(&thread->flags) & THREAD_DEAD) != 0) - return; - // call cleanup handlers while (true) { struct __pthread_cleanup_handler* handler diff --git a/src/system/libroot/posix/stdlib/exit.c b/src/system/libroot/posix/stdlib/exit.c index 8777d29f91..7649383771 100644 --- a/src/system/libroot/posix/stdlib/exit.c +++ b/src/system/libroot/posix/stdlib/exit.c @@ -22,7 +22,7 @@ extern void _IO_cleanup(void); -extern void _thread_do_exit_notification(void); +extern void _thread_do_exit_work(void); struct exit_stack_info { void (*exit_stack[ATEXIT_MAX])(void); @@ -127,7 +127,7 @@ void exit(int status) { // BeOS on exit notification for the main thread - _thread_do_exit_notification(); + _thread_do_exit_work(); // unwind the exit stack, calling the registered functions _exit_stack_lock();