Don't use the thread_exit vfunc
authorMatthias Clasen <mclasen@redhat.com>
Mon, 19 Sep 2011 03:18:17 +0000 (23:18 -0400)
committerRyan Lortie <desrt@desrt.ca>
Wed, 21 Sep 2011 20:06:54 +0000 (16:06 -0400)
Instead, just have the backends implement an internal function
named g_system_thread_exit.

glib/gthread-posix.c
glib/gthread-win32.c
glib/gthread.c
glib/gthreadprivate.h

index 6a25eec51e2b17730b55ba23ff2536714b5e351e..c3b8a2d095ae182811bb1b9948844aa590635c65 100644 (file)
@@ -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,
index 3c83d52ebde193e693ce99271f61afe7c6d524f8..f26ff4c8fe38952e9092eee3c249423257c500a3 100644 (file)
@@ -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
index 9bb0d62415a4db7dc0d90522ca9a58596ac63fc3..9d614ac151c09282794e175a2f56c7ec2c8571b5 100644 (file)
@@ -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 ();
 }
 
 /**
index 3dde48420f6802418dc28514ff76ca57da3e757a..15f2452ddd8a2a162c51cb0946a4c5730ecf683a 100644 (file)
@@ -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);