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