[glib/wip/glib-next: 15/22] invert gthread-impl includes
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/glib-next: 15/22] invert gthread-impl includes
- Date: Thu, 1 Sep 2011 03:05:45 +0000 (UTC)
commit b229a8c911e408e67dfa5e6c968aaaa835f0d770
Author: Ryan Lortie <desrt desrt ca>
Date: Wed Aug 31 17:40:01 2011 -0400
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 c9b8a7a..c44be74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2388,8 +2388,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 e142621..700f39c 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 19608c2..bd7ba79 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 2d5dd7e..da580a7 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 <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"
diff --git a/gthread/gthread-win32.c b/gthread/gthread-win32.c
index 8ebb0b6..bfd1ef7 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"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]