6#include <QtCore/private/qsimd_p.h>
8#if !defined(QT_NO_CONCURRENT) || defined(Q_QDOC)
60 int localCount =
count.loadRelaxed();
62 if (
count.testAndSetOrdered(localCount, localCount -1))
65 if (
count.testAndSetOrdered(localCount, localCount + 1))
75 int localCount =
count.loadRelaxed();
76 if (localCount == -1) {
77 if (
count.testAndSetOrdered(-1, 0)) {
81 }
else if (localCount < 0) {
82 if (
count.testAndSetOrdered(localCount, localCount + 1))
83 return qAbs(localCount + 1);
85 if (
count.testAndSetOrdered(localCount, localCount - 1))
86 return localCount - 1;
96 int localCount =
count.loadRelaxed();
101 if (
count.testAndSetOrdered(localCount, -localCount)) {
111 return count.loadRelaxed();
119 int localCount =
count.loadRelaxed();
120 if (
qAbs(localCount) == 1) {
122 }
else if (localCount < 0) {
123 if (
count.testAndSetOrdered(localCount, localCount + 1))
126 if (
count.testAndSetOrdered(localCount, localCount - 1))
151 startThreadInternal();
197bool ThreadEngineBase::startThreadInternal()
210void ThreadEngineBase::startThreads()
216void ThreadEngineBase::threadExit()
221 if (lastThread && asynchronous)
228bool ThreadEngineBase::threadThrottleExit()
242#ifndef QT_NO_EXCEPTIONS
250 if (threadThrottleExit()) {
261#ifndef QT_NO_EXCEPTIONS
271#ifndef QT_NO_EXCEPTIONS
273void ThreadEngineBase::handleException(
const QException &exception)
bool isSuspending() const
void setProgressValue(int progressValue)
void setProgressRange(int minimum, int maximum)
void reportException(const QException &e)
void reportSuspended() const
void setAutoDelete(bool autoDelete)
Enables auto-deletion if autoDelete is true; otherwise auto-deletion is disabled.
void acquire(int n=1)
Tries to acquire n resources guarded by the semaphore.
void release(int n=1)
Releases n resources guarded by the semaphore.
bool tryStart(QRunnable *runnable)
Attempts to reserve a thread to run runnable.
ThreadEngineBarrier barrier
void setProgressValue(int progress)
void setProgressRange(int minimum, int maximum)
virtual ThreadFunctionResult threadFunction()
virtual void asynchronousFinish()=0
virtual ~ThreadEngineBase()
bool isProgressReportingEnabled()
virtual bool shouldStartThread()
QtPrivate::ExceptionStore exceptionStore
void reportIfSuspensionDone() const
void run() override
Implement this pure virtual function in your subclass.
void acquireBarrierSemaphore()
ThreadEngineBase(QThreadPool *pool)
QFutureInterfaceBase * futureInterface
void startSingleThreaded()
void setException(const QException &e)
bool hasException() const
Combined button and popup list for selecting options.
constexpr T qAbs(const T &t)
GLenum GLenum GLsizei count