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