ThreadWeaver
WeaverImpl.cpp
Go to the documentation of this file.
419 debug( 0, "--> %4i: %p %s (priority %i, can be executed: %s)\n", index, (void*)m_assignments.at( index ),
void blockThreadUntilJobsAreBeingAssigned(Thread *th)
Blocks the calling thread until some actor calls assignJobs.
Definition: WeaverImpl.cpp:364
void assignJobs()
Schedule enqueued jobs to be executed by idle threads.
Definition: WeaverImpl.cpp:288
QWaitCondition m_jobAvailable
Wait condition all idle or done threads wait for.
Definition: WeaverImpl.h:169
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: WeaverImpl.cpp:380
int m_active
The number of jobs that are assigned to the worker threads, but not finished.
Definition: WeaverImpl.h:165
void threadStarted(ThreadWeaver::Thread *)
A Thread has been created.
InConstructionState handles the calls to the WeaverImpl object until the constructor has finished.
Definition: InConstructionState.h:46
virtual void aboutToBeDequeued(WeaverInterface *weaver)
This Job is about the be dequeued from the weaver's job queue.
Definition: Job.cpp:161
WeaverInterface provides a common interface for weaver implementations.
Definition: WeaverInterface.h:61
StateId
All weaver objects maintain a state of operation which can be queried by the application.
Definition: State.h:48
virtual void activated()
The state has been changed so that this object is responsible for state handling.
Definition: State.cpp:74
int maximumNumberOfThreads() const
Get the maximum number of threads this Weaver may start.
Definition: WeaverImpl.cpp:156
#define P_ASSERT(x)
P_ASSERT ensures that error messages occur in the correct order.
Definition: DebuggingAids.h:103
ShuttingDownState is enabled when the Weaver destructor is entered.
Definition: ShuttingDownState.h:44
void debug(int severity, const char *cformat,...)
This method prints a text message on the screen, if debugging is enabled.
Definition: DebuggingAids.h:112
Definition: DebuggingAids.h:51
void asyncThreadSuspended(ThreadWeaver::Thread *)
void waitForAvailableJob(Thread *th)
Wait for a job to become available.
Definition: WeaverImpl.cpp:359
void jobDone(ThreadWeaver::Job *)
This signal is emitted when a job is finished.
We use a State pattern to handle the system state in ThreadWeaver.
Definition: State.h:74
void threadSuspended(ThreadWeaver::Thread *)
A thread has been suspended.
virtual void waitForAvailableJob(Thread *th)=0
Wait (by suspending the calling thread) until a job becomes available.
void stateChanged(ThreadWeaver::State *)
The Weaver's state has changed.
DestructedState is only active after the thread have been destroyed by the destructor,...
Definition: DestructedState.h:44
@ InConstruction
The object is in the state of construction and has not yet started to process jobs.
Definition: State.h:51
void finished()
This signal is emitted when the Weaver has finished ALL currently queued jobs.
bool isEmpty() const
Is the queue empty? The queue is empty if no more jobs are queued.
Definition: WeaverImpl.cpp:293
A Job is a simple abstraction of an action that is to be executed in a thread context.
Definition: Job.h:66
@ Suspending
Job processing is suspended, but some jobs which where already in progress are not finished yet.
Definition: State.h:56
The class Thread is used to represent the worker threads in the weaver's inventory.
Definition: Thread.h:47
virtual Job * applyForWork(Thread *thread, Job *previous)
Assign a job to the calling thread.
Definition: WeaverImpl.cpp:354
SuspendingState is the state after suspend() has been called, but before all threads finished executi...
Definition: SuspendingState.h:45
void threadBusy(ThreadWeaver::Thread *, ThreadWeaver::Job *j)
The thread is busy executing job j.
Job * takeFirstAvailableJob(Job *previous)
Take the first available job out of the queue and return it.
Definition: WeaverImpl.cpp:333
void setMaximumNumberOfThreads(int cap)
Set the maximum number of threads this Weaver object may start.
Definition: WeaverImpl.cpp:149
Observers provides signals on some Weaver events that are otherwise only available through objects of...
Definition: WeaverObserver.h:59
int currentNumberOfThreads() const
Returns the current number of threads in the inventory.
Definition: WeaverImpl.cpp:162
In SuspendedState, jobs are queued, but will not be executed.
Definition: SuspendedState.h:44
virtual Job * applyForWork(Thread *th, Job *previous)=0
Assign a job to an idle thread.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 27 2020 00:00:00 by doxygen 1.8.20 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 27 2020 00:00:00 by doxygen 1.8.20 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.