From b2c236792c6eaa676b2dce3d8abb4f5948957699 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 30 Apr 2024 10:12:34 -0700 Subject: [PATCH] QThread: relax memory semantics from seq_cst on interruptionRequested Amends a0faf9e23666d4aa26a93d6e9ebf420e71d5e6c2. Pick-to: 6.7 Change-Id: I262c3499666e4f4fbcfbfffd17cb1e141ad104d8 Reviewed-by: Marc Mutz --- src/corelib/thread/qthread_unix.cpp | 4 ++-- src/corelib/thread/qthread_win.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 23a79074d69..617a5ebf28c 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -365,7 +365,7 @@ void QThreadPrivate::finish(void *arg) d->running = false; d->finished = true; - d->interruptionRequested = false; + d->interruptionRequested.store(false, std::memory_order_relaxed); d->isInFinish = false; d->data->threadId.storeRelaxed(nullptr); @@ -642,7 +642,7 @@ void QThread::start(Priority priority) d->finished = false; d->returnCode = 0; d->exited = false; - d->interruptionRequested = false; + d->interruptionRequested.store(false, std::memory_order_relaxed); pthread_attr_t attr; pthread_attr_init(&attr); diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 3e0eef411a0..74bc1d26505 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -314,7 +314,7 @@ void QThreadPrivate::finish(void *arg, bool lockAnyway) noexcept d->running = false; d->finished = true; d->isInFinish = false; - d->interruptionRequested = false; + d->interruptionRequested.store(false, std::memory_order_relaxed); if (!d->waiters) { CloseHandle(d->handle); @@ -391,7 +391,7 @@ void QThread::start(Priority priority) d->finished = false; d->exited = false; d->returnCode = 0; - d->interruptionRequested = false; + d->interruptionRequested.store(false, std::memory_order_relaxed); /* NOTE: we create the thread in the suspended state, set the