From 88bb31bfa7d06513fa79dcfdac1c3bd1842cbf8c Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Wed, 20 Mar 2013 16:46:11 +0000 Subject: [PATCH] glib: Use GTHREAD preprocessor flag with old versions of glib We switch the logic from DISABLE_GTHREAD_CHECK to ENABLE_GTHREAD_INIT to make the define clearer, and so that it is actually needed when using older versions of glib, not newer. Signed-off-by: Bertrand Lorentz --- configure.ac | 4 ++-- glib/Thread.cs | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index c65c12d54..58004262b 100644 --- a/configure.ac +++ b/configure.ac @@ -177,8 +177,8 @@ CSFLAGS="$DEBUG_FLAGS $WIN64DEFINES" PKG_CHECK_MODULES(GLIB_2_31, glib-2.0 >= 2.31, HAVE_GLIB_2_31_OR_HIGHER=yes, HAVE_GLIB_2_31_OR_HIGHER=no) -if test "x$HAVE_GLIB_2_31_OR_HIGHER" = "xyes" ; then - CSFLAGS="$CSFLAGS -define:DISABLE_GTHREAD_CHECK" +if test "x$HAVE_GLIB_2_31_OR_HIGHER" = "xno" ; then + CSFLAGS="$CSFLAGS -define:ENABLE_GTHREAD_INIT" fi AC_SUBST(CSFLAGS) diff --git a/glib/Thread.cs b/glib/Thread.cs index 249dd048e..703256219 100644 --- a/glib/Thread.cs +++ b/glib/Thread.cs @@ -28,18 +28,7 @@ namespace GLib { private Thread () {} -#if DISABLE_GTHREAD_CHECK - public static void Init () - { - // GLib automatically inits threads in 2.31 and above - // http://developer.gnome.org/glib/unstable/glib-Deprecated-Thread-APIs.html#g-thread-init - } - - public static bool Supported - { - get { return true; } - } -#else +#if ENABLE_GTHREAD_INIT [DllImport ("libgthread-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern void g_thread_init (IntPtr i); @@ -57,6 +46,17 @@ namespace GLib return g_thread_get_initialized (); } } +#else + public static void Init () + { + // GLib automatically inits threads in 2.31 and above + // http://developer.gnome.org/glib/unstable/glib-Deprecated-Thread-APIs.html#g-thread-init + } + + public static bool Supported + { + get { return true; } + } #endif }