From 96e489680423f87428c74b1f6ec8a6b8a9c99645 Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Wed, 31 Aug 2011 17:40:01 -0400 Subject: [PATCH] invert gthread-impl includes configure.ac defined G_THREAD_SOURCE and gthread-impl would #include it. Instead, since we only have two thread implementations now, and since we always use the Windows one only on Windows, move the logic to the Makefile, predicated on 'if OS_WIN32'. Then have the chosen backend do the #include "gthread-impl.c" from there. Remove the G_THREAD_SOURCE define from configure.ac. --- configure.ac | 2 -- gthread/Makefile.am | 6 +++++- gthread/gthread-impl.c | 7 ------- gthread/gthread-posix.c | 5 +++++ gthread/gthread-win32.c | 3 +++ 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index d1944b80a..ec0ae028d 100644 --- a/configure.ac +++ b/configure.ac @@ -2419,8 +2419,6 @@ case $host in ;; esac -AC_DEFINE_UNQUOTED(G_THREAD_SOURCE,"gthread-$have_threads.c", - [Source file containing thread implementation]) AC_SUBST(G_THREAD_CFLAGS) AC_SUBST(G_THREAD_LIBS) AC_SUBST(G_THREAD_LIBS_FOR_GTHREAD) diff --git a/gthread/Makefile.am b/gthread/Makefile.am index e14262189..700f39c45 100644 --- a/gthread/Makefile.am +++ b/gthread/Makefile.am @@ -66,7 +66,11 @@ gthread_win32_res = gthread-win32-res.o gthread_win32_res_ldflag = -Wl,$(gthread_win32_res) endif -libgthread_2_0_la_SOURCES = gthread-impl.c +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_LDFLAGS = $(GLIB_LINK_FLAGS) \ $(gthread_win32_res_ldflag) \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ diff --git a/gthread/gthread-impl.c b/gthread/gthread-impl.c index 19608c2b6..bd7ba79a3 100644 --- a/gthread/gthread-impl.c +++ b/gthread/gthread-impl.c @@ -31,13 +31,6 @@ * MT safe */ -#include "config.h" - -#include "glib.h" -#include "gthreadprivate.h" - -#include G_THREAD_SOURCE - void g_thread_init (GThreadFunctions *init) { diff --git a/gthread/gthread-posix.c b/gthread/gthread-posix.c index 2d5dd7e6f..da580a766 100644 --- a/gthread/gthread-posix.c +++ b/gthread/gthread-posix.c @@ -33,6 +33,9 @@ #include "config.h" +#include "glib.h" +#include "gthreadprivate.h" + #include #include #include @@ -402,3 +405,5 @@ static GThreadFunctions g_thread_functions_for_glib_use_default = g_thread_self_posix_impl, g_thread_equal_posix_impl }; + +#include "gthread-impl.c" diff --git a/gthread/gthread-win32.c b/gthread/gthread-win32.c index 8ebb0b68b..bfd1ef77f 100644 --- a/gthread/gthread-win32.c +++ b/gthread/gthread-win32.c @@ -35,6 +35,7 @@ #include "config.h" #include "glib.h" +#include "gthreadprivate.h" #define STRICT #define _WIN32_WINDOWS 0x0401 /* to get IsDebuggerPresent */ @@ -558,3 +559,5 @@ g_thread_impl_init () (g_cond_event_tls = TlsAlloc ())); InitializeCriticalSection (&g_thread_global_spinlock); } + +#include "gthread-impl.c"