if OS_UNIX
libglib_2_0_la_SOURCES += glib-unix.c
-endif
+endif
+
+if OS_WIN32
+libglib_2_0_la_SOURCES += gthread-win32.c
+else
+libglib_2_0_la_SOURCES += gthread-posix.c
+endif
EXTRA_libglib_2_0_la_SOURCES = \
giounix.c \
pcre_inc =
endif
-libglib_2_0_la_LIBADD = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ @ICONV_LIBS@ @G_LIBS_EXTRA@ $(pcre_lib) $(GLIB_RT_LIBS)
+libglib_2_0_la_LIBADD = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ @ICONV_LIBS@ @G_LIBS_EXTRA@ $(pcre_lib) $(GLIB_RT_LIBS) $(G_THREAD_LIBS_EXTRA) $(G_THREAD_LIBS_FOR_GTHREAD)
libglib_2_0_la_DEPENDENCIES = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ $(glib_win32_res) $(glib_def)
libglib_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS) \
#define G_MUTEX_SIZE (sizeof (pthread_mutex_t))
-static void
-g_thread_impl_init(void)
+void
+_g_thread_impl_init(void)
{
#ifdef _SC_THREAD_STACK_MIN
g_thread_min_stack_size = MAX (sysconf (_SC_THREAD_STACK_MIN), 0);
return (pthread_equal (*(pthread_t*)thread1, *(pthread_t*)thread2) != 0);
}
-static GThreadFunctions g_thread_functions_for_glib_use_default =
+GThreadFunctions g_thread_functions_for_glib_use =
{
g_mutex_new_posix_impl,
(void (*)(GMutex *)) pthread_mutex_lock,
g_thread_self_posix_impl,
g_thread_equal_posix_impl
};
-
-#include "gthread-impl.c"
static guint g_private_next = 0;
-/* A "forward" declaration of this structure */
-static GThreadFunctions g_thread_functions_for_glib_use_default;
-
typedef struct _GThreadData GThreadData;
struct _GThreadData
{
g_free (target);
}
-static GThreadFunctions g_thread_functions_for_glib_use_default =
+GThreadFunctions g_thread_functions_for_glib_use =
{
g_mutex_new_win32_impl, /* mutex */
g_mutex_lock_win32_impl,
NULL /* no equal function necessary */
};
-static void
-g_thread_impl_init ()
+void
+_g_thread_impl_init (void)
{
static gboolean beenhere = FALSE;
(g_cond_event_tls = TlsAlloc ()));
InitializeCriticalSection (&g_thread_global_spinlock);
}
-
-#include "gthread-impl.c"
*
* For that reason, all of those macros are documented here.
*/
-GThreadFunctions g_thread_functions_for_glib_use = {
+static GThreadFunctions g_thread_functions_for_glib_use_old = {
/* GMutex Virtual Functions {{{2 ------------------------------------------ */
/**
void
g_thread_init_glib (void)
{
+ _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
*/
G_GNUC_INTERNAL void _g_atomic_thread_init (void);
G_GNUC_INTERNAL void _g_utils_thread_init (void);
G_GNUC_INTERNAL void _g_futex_thread_init (void);
+G_GNUC_INTERNAL void _g_thread_impl_init (void);
#ifdef G_OS_WIN32
G_GNUC_INTERNAL void _g_win32_thread_init (void);
EXTRA_DIST += \
makefile.msc.in \
- gthread-posix.c \
- gthread-win32.c \
gthread.def \
gthread.rc.in
gthread_win32_res_ldflag = -Wl,$(gthread_win32_res)
endif
-if OS_WIN32
-libgthread_2_0_la_SOURCES = gthread-win32.c
-else
-libgthread_2_0_la_SOURCES = gthread-posix.c
-endif
+libgthread_2_0_la_SOURCES = gthread-impl.c
libgthread_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS) \
$(gthread_win32_res_ldflag) \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
* MT safe
*/
+#include "glib.h"
+
+#include "gthreadprivate.h"
+
void
g_thread_init (GThreadFunctions *init)
{
already_done = TRUE;
- g_thread_impl_init ();
- g_thread_functions_for_glib_use = g_thread_functions_for_glib_use_default;
g_thread_init_glib ();
}