[glib] gthread: remove impl init functions



commit 42af8eb39d2744af68a470bcd9f7aae3c8f43602
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed Sep 21 00:33:16 2011 -0400

    gthread: remove impl init functions

 glib/gthread-posix.c  |   14 +++-----------
 glib/gthread-win32.c  |   20 +++-----------------
 glib/gthread.c        |    2 --
 glib/gthreadprivate.h |    3 ---
 4 files changed, 6 insertions(+), 33 deletions(-)
---
diff --git a/glib/gthread-posix.c b/glib/gthread-posix.c
index b23a19a..76697f2 100644
--- a/glib/gthread-posix.c
+++ b/glib/gthread-posix.c
@@ -480,19 +480,9 @@ g_private_set (GPrivate *key,
 
 #define posix_check_cmd(cmd) posix_check_err (cmd, #cmd)
 
-static gulong g_thread_min_stack_size = 0;
-
 #define G_MUTEX_SIZE (sizeof (pthread_mutex_t))
 
 void
-_g_thread_impl_init(void)
-{
-#ifdef _SC_THREAD_STACK_MIN
-  g_thread_min_stack_size = MAX (sysconf (_SC_THREAD_STACK_MIN), 0);
-#endif /* _SC_THREAD_STACK_MIN */
-}
-
-void
 g_system_thread_create (GThreadFunc       thread_func,
                         gpointer          arg,
                         gulong            stack_size,
@@ -510,7 +500,9 @@ g_system_thread_create (GThreadFunc       thread_func,
 #ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE
   if (stack_size)
     {
-      stack_size = MAX (g_thread_min_stack_size, stack_size);
+#ifdef _SC_THREAD_STACK_MIN
+      stack_size = MAX (sysconf (_SC_THREAD_STACK_MIN), stack_size);
+#endif /* _SC_THREAD_STACK_MIN */
       /* No error check here, because some systems can't do it and
        * we simply don't want threads to fail because of that. */
       pthread_attr_setstacksize (&attr, stack_size);
diff --git a/glib/gthread-win32.c b/glib/gthread-win32.c
index 00702c7..cadd0c7 100644
--- a/glib/gthread-win32.c
+++ b/glib/gthread-win32.c
@@ -858,23 +858,6 @@ g_thread_xp_init (void)
 
 /* {{{1 Epilogue */
 
-void
-_g_thread_impl_init (void)
-{
-  static gboolean beenhere = FALSE;
-
-  if (beenhere)
-    return;
-
-  beenhere = TRUE;
-
-  printf ("thread init\n");
-  win32_check_for_error (TLS_OUT_OF_INDEXES !=
-			 (g_thread_self_tls = TlsAlloc ()));
-  win32_check_for_error (TLS_OUT_OF_INDEXES !=
-			 (g_private_tls = TlsAlloc ()));
-}
-
 static gboolean
 g_thread_lookup_native_funcs (void)
 {
@@ -916,6 +899,9 @@ g_thread_DllMain (void)
       fprintf (stderr, "(debug) GThread using Windows XP mode\n");
       g_thread_xp_init ();
     }
+
+  win32_check_for_error (TLS_OUT_OF_INDEXES != (g_thread_self_tls = TlsAlloc ()));
+  win32_check_for_error (TLS_OUT_OF_INDEXES != (g_private_tls = TlsAlloc ()));
 }
 
 /* vim:set foldmethod=marker: */
diff --git a/glib/gthread.c b/glib/gthread.c
index a3f4b6a..c5cf929 100644
--- a/glib/gthread.c
+++ b/glib/gthread.c
@@ -657,8 +657,6 @@ g_thread_init_glib (void)
 
   already_done = TRUE;
 
-  _g_thread_impl_init ();
-
   /* We let the main thread (the one that calls g_thread_init) inherit
    * the static_private data set before calling g_thread_init
    */
diff --git a/glib/gthreadprivate.h b/glib/gthreadprivate.h
index 707e571..dd23402 100644
--- a/glib/gthreadprivate.h
+++ b/glib/gthreadprivate.h
@@ -53,9 +53,6 @@ void g_thread_init_glib (void);
 /* initializers that may also use g_private_new() */
 G_GNUC_INTERNAL void _g_messages_thread_init_nomessage      (void);
 
-/* full fledged initializers */
-G_GNUC_INTERNAL void _g_thread_impl_init  (void);
-
 struct _GPrivate
 {
   gpointer single_value;



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