Files
MINGW-packages/mingw-w64-python3/0520-py3k-mingw-ntthreads-vs-pthreads.patch

44 lines
1.5 KiB
Diff

diff -Naur Python-3.7.0-orig/Include/internal/condvar.h Python-3.7.0/Include/internal/condvar.h
--- Python-3.7.0-orig/Include/internal/condvar.h 2018-06-27 06:07:35.000000000 +0300
+++ Python-3.7.0/Include/internal/condvar.h 2018-07-12 10:21:43.180791900 +0300
@@ -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 +39,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
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-07-12 10:21:43.165191900 +0300
@@ -9,6 +9,12 @@
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. */
typedef enum PyLockStatus {