diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2023-10-12 08:23:35 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2023-10-17 23:52:27 +0000 |
commit | dec72d165be9470ef8fa46901260fa1dc32d8568 (patch) | |
tree | 5380be414f9190cff8b305a93c3ad0a26de3fea0 | |
parent | 9e26f1da0b0dedf7ee6d860b7c11a27b0b554866 (diff) |
QThread/Unix: don't hardcode OSes for PThread cancellation support
Instead, check the macro that we're about to use. This is also done in
qprocess_unix.cpp
Pick-to: 6.5 6.6
Change-Id: I8f3ce163ccc5408cac39fffd178d657b7594d07a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
-rw-r--r-- | src/corelib/thread/qthread_unix.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index b0088d4ce0..1a1ad98134 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -277,7 +277,7 @@ void terminate_on_exception(T &&t) void *QThreadPrivate::start(void *arg) { -#if !defined(Q_OS_ANDROID) +#ifdef PTHREAD_CANCEL_DISABLE pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, nullptr); #endif pthread_cleanup_push(QThreadPrivate::finish, arg); @@ -319,7 +319,7 @@ void *QThreadPrivate::start(void *arg) #endif emit thr->started(QThread::QPrivateSignal()); -#if !defined(Q_OS_ANDROID) +#ifdef PTHREAD_CANCEL_DISABLE pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, nullptr); pthread_testcancel(); #endif |