[glib/wip/mutexes: 44/58] Don't use the thread_exit vfunc



commit f4aabc6bcce481f14836f09a18e27547390e654f
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Sep 18 23:18:17 2011 -0400

    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 6a25eec..c3b8a2d 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 3c83d52..f26ff4c 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 978fbcf..61711a7 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
  *
- * <informalexample>
- *  <programlisting>
+ * |[
  *   g_thread_exit (retval);
- *  </programlisting>
- * </informalexample>
+ * ]|
  *
  * 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 3dde484..15f2452 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);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]