summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-05-18 10:01:58 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-05-29 13:27:40 +0000
commitafab37a4de76bcf2d0c0daf847c035b1570e9271 (patch)
treee97d70c573ad28971a8ced1a326338eac9fba4c7 /src/corelib/thread
parent40206a9f6d7635bb19305d1c8d74908808e3529e (diff)
QThread: Refine check for presence of std::future
MinGW with win32 threads might not have _GLIBCXX_HAS_GTHREADS, so it needs to be checked. Amends change 597d4ff7962c0add87e4b93da4c366503d11aff5. Change-Id: I5c91d1dd3967c4922ced315b475d653b8b102ad6 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/corelib/thread')
-rw-r--r--src/corelib/thread/qthread.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h
index a061394deb..5e6f216219 100644
--- a/src/corelib/thread/qthread.h
+++ b/src/corelib/thread/qthread.h
@@ -43,11 +43,15 @@
#include <QtCore/qobject.h>
// The implementation of QThread::create uses various C++14/C++17 facilities;
-// we must check for their presence. For std::async (used in all codepaths)
+// we must check for their presence. Specifically for glibcxx bundled in MinGW
+// with win32 threads, we check the condition found in its <future> header
+// since _GLIBCXX_HAS_GTHREADS might then not be defined.
+// For std::async (used in all codepaths)
// there is no SG10 feature macro; just test for the header presence.
// For the C++17 codepath do some more throughout checks for std::invoke and
// C++14 lambdas availability.
-#if QT_HAS_INCLUDE(<future>)
+#if QT_HAS_INCLUDE(<future>) \
+ && (!defined(__GLIBCXX__) || (defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)))
# define QTHREAD_HAS_CREATE
# include <future> // for std::async
# include <functional> // for std::invoke; no guard needed as it's a C++98 header