[glib/wip/mutexes: 31/58] Don't use the thread vtable for g_thread_yield()



commit 4cc1cb87303d924827fdc60a3f1f71154f4ab294
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Sep 18 21:39:35 2011 -0400

    Don't use the thread vtable for g_thread_yield()

 glib/gthread-posix.c |    6 +++---
 glib/gthread-win32.c |    6 +++---
 glib/gthread.c       |   15 ---------------
 3 files changed, 6 insertions(+), 21 deletions(-)
---
diff --git a/glib/gthread-posix.c b/glib/gthread-posix.c
index c09a645..5e51634 100644
--- a/glib/gthread-posix.c
+++ b/glib/gthread-posix.c
@@ -629,8 +629,8 @@ g_thread_create_posix_impl (GThreadFunc thread_func,
   posix_check_err (ret, "pthread_create");
 }
 
-static void
-g_thread_yield_posix_impl (void)
+void
+g_thread_yield (void)
 {
   sched_yield ();
 }
@@ -696,7 +696,7 @@ GThreadFunctions g_thread_functions_for_glib_use =
   g_private_get,
   g_private_set,
   g_thread_create_posix_impl,
-  g_thread_yield_posix_impl,
+  g_thread_yield,
   g_thread_join_posix_impl,
   g_thread_exit_posix_impl,
   g_thread_set_priority_posix_impl,
diff --git a/glib/gthread-win32.c b/glib/gthread-win32.c
index cc1dad3..33e1253 100644
--- a/glib/gthread-win32.c
+++ b/glib/gthread-win32.c
@@ -479,8 +479,8 @@ g_thread_create_win32_impl (GThreadFunc func,
   g_thread_set_priority_win32_impl (thread, priority);
 }
 
-static void
-g_thread_yield_win32_impl (void)
+void
+g_thread_yield (void)
 {
   Sleep(0);
 }
@@ -798,7 +798,7 @@ GThreadFunctions g_thread_functions_for_glib_use =
   g_private_get,
   g_private_set,
   g_thread_create_win32_impl,       /* thread */
-  g_thread_yield_win32_impl,
+  g_thread_yield,
   g_thread_join_win32_impl,
   g_thread_exit_win32_impl,
   g_thread_set_priority_win32_impl,
diff --git a/glib/gthread.c b/glib/gthread.c
index 65d1868..4ed4d24 100644
--- a/glib/gthread.c
+++ b/glib/gthread.c
@@ -1960,21 +1960,6 @@ g_thread_self (void)
   return (GThread*)thread;
 }
 
-/**
- * g_thread_yield:
- *
- * Gives way to other threads waiting to be scheduled.
- *
- * This function is often used as a method to make busy wait less evil.
- * But in most cases you will encounter, there are better methods to do
- * that. So in general you shouldn't use this function.
- */
-void
-g_thread_yield (void)
-{
-  G_THREAD_UF (thread_yield, ());
-}
-
 /* GStaticRWLock {{{1 ----------------------------------------------------- */
 
 /**



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