From a4248cf53b4dc9a6f602201c96c9f4a5c03276c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Mon, 18 Jan 2010 17:58:38 +0000 Subject: [PATCH] * Rename _thread_do_exit_notification() to _thread_do_exit_work() as suggested by Ingo. Also added an empty stub for _thread_do_exit_notification() when compiling for GCC2. * Removed the check testing if the thread is already dead. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35142 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/os/thread.c | 13 +++++++++++-- src/system/libroot/posix/pthread/pthread.c | 4 ---- src/system/libroot/posix/stdlib/exit.c | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) 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();