Commit 2ca9dda7 authored by LRN's avatar LRN Committed by Alexander Larsson

win32: Allow POSIX threads to be used if --with-threads=posix

All tests pass with this patch AND a good pthreads implementation
(i'm using winpthreads, not pthreads-w32).

https://bugzilla.gnome.org/show_bug.cgi?id=697626
parent 0a130c8b
......@@ -2177,14 +2177,20 @@ AS_IF([test x$have_threads = xposix], [
])
g_threads_impl="POSIX"
AC_DEFINE([THREADS_POSIX], [1], [Use pthreads])
AC_SUBST(GTHREAD_COMPILE_IMPL_DEFINES)
CPPFLAGS="$glib_save_CPPFLAGS"
], [test x$have_threads = xwin32], [
AC_DEFINE([THREADS_WIN32], [1], [Use w32 threads])
g_threads_impl="WIN32"
], [
AC_DEFINE([THREADS_NONE], [1], [Use no threads])
g_threads_impl="NONE"
G_THREAD_LIBS=error
])
AM_CONDITIONAL(THREADS_POSIX, [test "$g_threads_impl" = "POSIX"])
AM_CONDITIONAL(THREADS_WIN32, [test "$g_threads_impl" = "WIN32"])
AM_CONDITIONAL(THREADS_NONE, [test "$g_threads_impl" = "NONE"])
if test "x$G_THREAD_LIBS" = xerror; then
AC_MSG_ERROR($LIBS_NOT_FOUND_1$have_threads$LIBS_NOT_FOUND_2)
......
......@@ -214,11 +214,13 @@ if OS_UNIX
libglib_2_0_la_SOURCES += glib-unix.c
endif
if OS_WIN32
if THREADS_WIN32
libglib_2_0_la_SOURCES += gthread-win32.c
else
if THREADS_POSIX
libglib_2_0_la_SOURCES += gthread-posix.c
endif
endif
EXTRA_libglib_2_0_la_SOURCES = \
giounix.c \
......
......@@ -239,12 +239,16 @@ DllMain (HINSTANCE hinstDLL,
case DLL_PROCESS_ATTACH:
glib_dll = hinstDLL;
g_clock_win32_init ();
#ifdef THREADS_WIN32
g_thread_win32_init ();
#endif
glib_init ();
break;
case DLL_THREAD_DETACH:
#ifdef THREADS_WIN32
g_thread_win32_thread_detach ();
#endif
break;
default:
......
......@@ -66,6 +66,9 @@
#ifdef HAVE_SYS_PRCTL_H
#include <sys/prctl.h>
#endif
#ifdef G_OS_WIN32
#include <windows.h>
#endif
static void
g_thread_abort (gint status,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment