diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2023-10-12 08:23:35 -0700 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-10-18 06:10:54 +0000 |
commit | e2dc10b41022c209f9c505e3278906948646ed5c (patch) | |
tree | b4e2f95d809ee12a57d0956cbdda095b7572d204 | |
parent | cd8b74d4f612ce4de052a5bf35b06f19d8717a92 (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
Change-Id: I8f3ce163ccc5408cac39fffd178d657b7594d07a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit dec72d165be9470ef8fa46901260fa1dc32d8568)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 19ad8769639637099b6f02c17c113125683ab2c6)
-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 fa03b2ea10..9a089d9d28 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -272,7 +272,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); @@ -314,7 +314,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 |