Files
MINGW-packages/mingw-w64-python3/0520-py3k-mingw-ntthreads-vs-pthreads.patch
T
2013-12-27 11:17:12 +04:00

75 lines
2.3 KiB
Diff

diff -urN a/configure.ac b/configure.ac
--- a/configure.ac 2013-12-26 18:46:57.998169400 +0000
+++ b/configure.ac 2013-12-26 18:47:03.061459000 +0000
@@ -1671,7 +1671,7 @@
CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
fcntl.h grp.h \
-ieeefp.h io.h langinfo.h libintl.h ncurses.h process.h pthread.h \
+ieeefp.h io.h langinfo.h libintl.h ncurses.h process.h \
sched.h shadow.h signal.h stdint.h stropts.h termios.h \
unistd.h utime.h \
poll.h sys/devpoll.h sys/epoll.h sys/poll.h \
@@ -1703,6 +1703,14 @@
])
+# If using nt threads, don't look for pthread.h or thread.h
+if test "x$ac_cv_ntthread" = xno ; then
+AC_HEADER_STDC
+AC_CHECK_HEADERS(pthread.h thread.h)
+AC_HEADER_DIRENT
+AC_HEADER_MAJOR
+fi
+
# On Solaris, term.h requires curses.h
AC_CHECK_HEADERS(term.h,,,[
#ifdef HAVE_CURSES_H
@@ -2366,9 +2374,11 @@
:
else
if test "$with_threads" = "yes" -o -z "$with_threads"; then
- AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
- # posix4 on Solaris 2.6
- # pthread (first!) on Linux
+ if test "$ac_cv_ntthread" = "no" -o -z "$ac_cv_ntthread"; then
+ AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
+ # posix4 on Solaris 2.6
+ # pthread (first!) on Linux
+ fi
fi
fi
diff -urN a/Python/condvar.h b/Python/condvar.h
--- a/Python/condvar.h 2013-12-26 18:46:59.839274700 +0000
+++ b/Python/condvar.h 2013-12-26 18:47:03.063459100 +0000
@@ -42,6 +42,12 @@
#include "Python.h"
+#ifdef __MINGW32__
+# if !defined(HAVE_PTHREAD_H) || defined(NT_THREADS)
+# undef _POSIX_THREADS
+# endif
+#endif
+
#ifndef _POSIX_THREADS
/* This means pthreads are not implemented in libc headers, hence the macro
not present in unistd.h. But they still can be implemented as an external
diff -urN a/Python/thread.c b/Python/thread.c
--- a/Python/thread.c 2013-12-26 18:46:59.866276200 +0000
+++ b/Python/thread.c 2013-12-26 18:47:03.065459200 +0000
@@ -7,6 +7,12 @@
#include "Python.h"
+#ifdef __MINGW32__
+# if !defined(HAVE_PTHREAD_H) || defined(NT_THREADS)
+# undef _POSIX_THREADS
+# endif
+#endif
+
#ifndef _POSIX_THREADS
/* This means pthreads are not implemented in libc headers, hence the macro
not present in unistd.h. But they still can be implemented as an external