From 1b4847c9434eec952357dad03cb0f598f101db17 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 19 Jun 2020 18:49:03 +0000 Subject: [PATCH] de-inline if condition in QThread::setTerminationEnabled() Signed-off-by: Ivailo Monev --- src/core/thread/qthread_unix.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/thread/qthread_unix.cpp b/src/core/thread/qthread_unix.cpp index 1168f5a86..463413377 100644 --- a/src/core/thread/qthread_unix.cpp +++ b/src/core/thread/qthread_unix.cpp @@ -482,9 +482,12 @@ void QThread::setTerminationEnabled(bool enabled) Q_ASSERT_X(currentThread() != Q_NULLPTR, "QThread::setTerminationEnabled()", "Current thread was not started with QThread."); - pthread_setcancelstate(enabled ? PTHREAD_CANCEL_ENABLE : PTHREAD_CANCEL_DISABLE, Q_NULLPTR); - if (enabled) + if (enabled) { + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, Q_NULLPTR); pthread_testcancel(); + } else { + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, Q_NULLPTR); + } } void QThread::setPriority(Priority priority) -- 2.11.0