Files
MINGW-packages/mingw-w64-python3/0520-py3k-mingw-ntthreads-vs-pthreads.patch
2018-07-09 14:29:26 +03:00

43 lines
1.4 KiB
Diff

diff -Naur Python-3.7.0-orig/Include/pythread.h Python-3.7.0/Include/pythread.h
--- Python-3.7.0-orig/Include/pythread.h 2018-06-27 06:07:35.000000000 +0300
+++ Python-3.7.0/Include/pythread.h 2018-06-30 11:16:52.253485700 +0300
@@ -8,6 +8,12 @@
#ifdef __cplusplus
extern "C" {
#endif
+
+#ifdef __MINGW32__
+# if !defined(HAVE_PTHREAD_H) || defined(NT_THREADS)
+# undef _POSIX_THREADS
+# endif
+#endif
/* Return status codes for Python lock acquisition. Chosen for maximum
* backwards compatibility, ie failure -> 0, success -> 1. */
--- Python-3.7.0/Include/internal/condvar.h.orig 2018-07-07 09:06:28.369895000 +0200
+++ Python-3.7.0/Include/internal/condvar.h 2018-07-07 09:07:42.544027000 +0200
@@ -1,6 +1,12 @@
#ifndef Py_INTERNAL_CONDVAR_H
#define Py_INTERNAL_CONDVAR_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
@@ -33,6 +33,10 @@
/* include windows if it hasn't been done before */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+/* winpthreads are involved via windows header, so need undef _POSIX_THREADS after header include */
+#if defined(_POSIX_THREADS)
+#undef _POSIX_THREADS
+#endif
/* options */
/* non-emulated condition variables are provided for those that want