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
This commit is contained in:
Руслан Ижбулатов 2013-04-09 14:09:33 +02:00 committed by Alexander Larsson
parent 0a130c8bb0
commit 2ca9dda72a
4 changed files with 16 additions and 1 deletions

View File

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

View File

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

View File

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

View File

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