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.
This commit is contained in:
Ryan Lortie 2011-08-31 17:40:01 -04:00
parent fc6a9275a4
commit 96e4896804
5 changed files with 13 additions and 10 deletions

View File

@ -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)

View File

@ -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) \

View File

@ -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)
{

View File

@ -33,6 +33,9 @@
#include "config.h"
#include "glib.h"
#include "gthreadprivate.h"
#include <pthread.h>
#include <errno.h>
#include <stdlib.h>
@ -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"

View File

@ -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"