ThreadWeaver
ThreadWeaver.cpp
Go to the documentation of this file.
A Job is a simple abstraction of an action that is to be executed in a thread context.
Definition Job.h:66
We use a State pattern to handle the system state in ThreadWeaver.
Definition State.h:74
A WeaverImpl is the manager of worker threads (Thread objects) to which it assigns jobs from its queu...
Definition WeaverImpl.h:52
WeaverInterface provides a common interface for weaver implementations.
Definition WeaverInterface.h:61
virtual bool isEmpty() const =0
Is the queue empty? The queue is empty if no more jobs are queued.
virtual void requestAbort()=0
Request aborts of the currently executed jobs.
virtual int currentNumberOfThreads() const =0
Returns the current number of threads in the inventory.
void finished()
This signal is emitted when the Weaver has finished ALL currently queued jobs.
virtual void finish()=0
Finish all queued operations, then return.
virtual void setMaximumNumberOfThreads(int cap)=0
Set the maximum number of threads this Weaver object may start.
void jobDone(ThreadWeaver::Job *)
This signal is emitted when a job is finished.
virtual const State & state() const =0
Return the state of the weaver object.
virtual int queueLength() const =0
Returns the number of pending jobs.
virtual void registerObserver(WeaverObserver *)=0
Register an observer.
virtual int maximumNumberOfThreads() const =0
Get the maximum number of threads this Weaver may start.
virtual bool isIdle() const =0
Is the weaver idle? The weaver is idle if no jobs are queued and no jobs are processed by the threads...
Observers provides signals on some Weaver events that are otherwise only available through objects of...
Definition WeaverObserver.h:59
The Weaver class provides the public implementation of the WeaverInterface.
Definition ThreadWeaver.h:66
virtual WeaverInterface * makeWeaverImpl()
The factory method to create the actual Weaver implementation.
Definition ThreadWeaver.cpp:65
static ThreadWeaver::Weaver * instance()
Return the global Weaver instance.
Definition ThreadWeaver.cpp:80
void setMaximumNumberOfThreads(int cap)
Set the maximum number of threads this Weaver object may start.
Definition ThreadWeaver.cpp:142
bool isIdle() const
Is the weaver idle? The weaver is idle if no jobs are queued and no jobs are processed by the threads...
Definition ThreadWeaver.cpp:132
bool isEmpty() const
Is the queue empty? The queue is empty if no more jobs are queued.
Definition ThreadWeaver.cpp:127
int maximumNumberOfThreads() const
Get the maximum number of threads this Weaver may start.
Definition ThreadWeaver.cpp:152
int currentNumberOfThreads() const
Returns the current number of threads in the inventory.
Definition ThreadWeaver.cpp:147
Definition DebuggingAids.h:51
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Thu Jul 18 2024 00:00:00 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Thu Jul 18 2024 00:00:00 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.