ThreadWeaver
weaver.h
31 * It extends the API of Queue, hiding methods that need to be public to implement state handling, but
69 JobPointer takeFirstAvailableJobOrSuspendOrWait(Thread *th, bool threadWasBusy, bool suspendIfAllThreadsInactive, bool justReturning);
A Job is a simple abstraction of an action that is to be executed in a thread context.
Definition job.h:47
We use a State pattern to handle the system state in ThreadWeaver.
Definition state.h:56
SuspendingState is the state after suspend() has been called, but before all threads finished executi...
Definition suspendingstate.h:23
void enqueue(const QList< JobPointer > &jobs) override
Queue a vector of jobs.
Definition weaver.cpp:203
void threadEnteredRun(Thread *thread)
Called from a new thread when entering the run method.
Definition weaver.cpp:489
void threadSuspended(ThreadWeaver::Thread *)
A thread has been suspended.
void blockThreadUntilJobsAreBeingAssigned_locked(Thread *th)
Blocks the calling thread until jobs can be assigned.
Definition weaver.cpp:596
JobPointer takeFirstAvailableJobOrSuspendOrWait(Thread *th, bool threadWasBusy, bool suspendIfAllThreadsInactive, bool justReturning)
Take the first available job out of the queue and return it.
Definition weaver.cpp:505
void waitForAvailableJob(Thread *th) override
Wait for a job to become available.
Definition weaver.cpp:579
int maximumNumberOfThreads() const override
Get the maximum number of threads this Weaver may start.
Definition weaver.cpp:177
int currentNumberOfThreads() const override
Returns the current number of threads in the inventory.
Definition weaver.cpp:190
void setMaximumNumberOfThreads(int cap) override
Set the maximum number of threads this Weaver object may start.
Definition weaver.cpp:158
void threadStarted(ThreadWeaver::Thread *)
A Thread has been created.
void blockThreadUntilJobsAreBeingAssigned(Thread *th)
Blocks the calling thread until jobs can be assigned.
Definition weaver.cpp:585
JobPointer applyForWork(Thread *thread, bool wasBusy) override
Assign a job to the calling thread.
Definition weaver.cpp:573
void suspend()
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
QThread * thread() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 31 2025 11:57:50 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 31 2025 11:57:50 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.