From a10306060c409c45b2ae7dc38813918ce5d611d4 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 18 Sep 2011 23:18:17 -0400 Subject: [PATCH] Don't use the thread_exit vfunc Instead, just have the backends implement an internal function named g_system_thread_exit. --- glib/gthread-posix.c | 6 +++--- glib/gthread-win32.c | 10 +++++----- glib/gthread.c | 9 ++++----- glib/gthreadprivate.h | 2 ++ 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/glib/gthread-posix.c b/glib/gthread-posix.c index 6a25eec51..c3b8a2d09 100644 --- a/glib/gthread-posix.c +++ b/glib/gthread-posix.c @@ -651,8 +651,8 @@ g_thread_join_posix_impl (gpointer thread) posix_check_cmd (pthread_join (*(pthread_t*)thread, &ignore)); } -static void -g_thread_exit_posix_impl (void) +void +g_system_thread_exit (void) { pthread_exit (NULL); } @@ -708,7 +708,7 @@ GThreadFunctions g_thread_functions_for_glib_use = g_thread_create_posix_impl, g_thread_yield, g_thread_join_posix_impl, - g_thread_exit_posix_impl, + g_system_thread_exit, g_thread_set_priority_posix_impl, g_thread_self_posix_impl, g_system_thread_equal, diff --git a/glib/gthread-win32.c b/glib/gthread-win32.c index 3c83d52eb..f26ff4c8f 100644 --- a/glib/gthread-win32.c +++ b/glib/gthread-win32.c @@ -371,8 +371,8 @@ g_thread_self_win32_impl (gpointer thread) *(GThreadData **)thread = self; } -static void -g_thread_exit_win32_impl (void) +void +g_system_thread_exit (void) { GThreadData *self = TlsGetValue (g_thread_self_tls); gboolean dtors_called; @@ -431,7 +431,7 @@ g_thread_proxy (gpointer data) self->func (self->data); - g_thread_exit_win32_impl (); + g_system_thread_exit (); g_assert_not_reached (); @@ -807,10 +807,10 @@ GThreadFunctions g_thread_functions_for_glib_use = g_thread_create_win32_impl, /* thread */ g_thread_yield, g_thread_join_win32_impl, - g_thread_exit_win32_impl, + g_system_thread_exit, g_thread_set_priority_win32_impl, g_thread_self_win32_impl, - NULL /* no equal function necessary */ + g_system_thread_equal }; void diff --git a/glib/gthread.c b/glib/gthread.c index 9bb0d6241..9d614ac15 100644 --- a/glib/gthread.c +++ b/glib/gthread.c @@ -1817,11 +1817,9 @@ g_thread_create_full (GThreadFunc func, * of g_thread_join(). If the current thread is not joinable, @retval * is ignored. Calling * - * - * + * |[ * g_thread_exit (retval); - * - * + * ]| * * is equivalent to returning @retval from the function @func, as given * to g_thread_create(). @@ -1835,7 +1833,8 @@ g_thread_exit (gpointer retval) { GRealThread* real = (GRealThread*) g_thread_self (); real->retval = retval; - G_THREAD_CF (thread_exit, (void)0, ()); + + g_system_thread_exit (); } /** diff --git a/glib/gthreadprivate.h b/glib/gthreadprivate.h index 3dde48420..15f2452dd 100644 --- a/glib/gthreadprivate.h +++ b/glib/gthreadprivate.h @@ -37,6 +37,8 @@ G_BEGIN_DECLS G_GNUC_INTERNAL gboolean g_system_thread_equal (gpointer thread1, gpointer thread2); +G_GNUC_INTERNAL void g_system_thread_exit (void); + /* Is called from gthread/gthread-impl.c */ void g_thread_init_glib (void);