gthread: remove impl init functions

This commit is contained in:
Ryan Lortie 2011-09-21 00:33:16 -04:00
parent 2539bd007d
commit 42af8eb39d
4 changed files with 6 additions and 33 deletions

View File

@ -480,18 +480,8 @@ g_private_set (GPrivate *key,
#define posix_check_cmd(cmd) posix_check_err (cmd, #cmd) #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)) #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 void
g_system_thread_create (GThreadFunc thread_func, g_system_thread_create (GThreadFunc thread_func,
gpointer arg, gpointer arg,
@ -510,7 +500,9 @@ g_system_thread_create (GThreadFunc thread_func,
#ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE #ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE
if (stack_size) 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 /* No error check here, because some systems can't do it and
* we simply don't want threads to fail because of that. */ * we simply don't want threads to fail because of that. */
pthread_attr_setstacksize (&attr, stack_size); pthread_attr_setstacksize (&attr, stack_size);

View File

@ -858,23 +858,6 @@ g_thread_xp_init (void)
/* {{{1 Epilogue */ /* {{{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 static gboolean
g_thread_lookup_native_funcs (void) g_thread_lookup_native_funcs (void)
{ {
@ -916,6 +899,9 @@ g_thread_DllMain (void)
fprintf (stderr, "(debug) GThread using Windows XP mode\n"); fprintf (stderr, "(debug) GThread using Windows XP mode\n");
g_thread_xp_init (); 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: */ /* vim:set foldmethod=marker: */

View File

@ -657,8 +657,6 @@ g_thread_init_glib (void)
already_done = TRUE; already_done = TRUE;
_g_thread_impl_init ();
/* We let the main thread (the one that calls g_thread_init) inherit /* We let the main thread (the one that calls g_thread_init) inherit
* the static_private data set before calling g_thread_init * the static_private data set before calling g_thread_init
*/ */

View File

@ -53,9 +53,6 @@ void g_thread_init_glib (void);
/* initializers that may also use g_private_new() */ /* initializers that may also use g_private_new() */
G_GNUC_INTERNAL void _g_messages_thread_init_nomessage (void); G_GNUC_INTERNAL void _g_messages_thread_init_nomessage (void);
/* full fledged initializers */
G_GNUC_INTERNAL void _g_thread_impl_init (void);
struct _GPrivate struct _GPrivate
{ {
gpointer single_value; gpointer single_value;