gthread: remove impl init functions
authorRyan Lortie <desrt@desrt.ca>
Wed, 21 Sep 2011 04:33:16 +0000 (00:33 -0400)
committerRyan Lortie <desrt@desrt.ca>
Wed, 21 Sep 2011 20:06:56 +0000 (16:06 -0400)
glib/gthread-posix.c
glib/gthread-win32.c
glib/gthread.c
glib/gthreadprivate.h

index b23a19a..76697f2 100644 (file)
@@ -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);
index 00702c7..cadd0c7 100644 (file)
@@ -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: */
index a3f4b6a..c5cf929 100644 (file)
@@ -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
    */
index 707e571..dd23402 100644 (file)
@@ -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;