ThreadWeaver
#include <JobCollection_p.h>
Public Member Functions | |
JobCollectionJobRunner (JobCollection *collection, Job *payload, QObject *parent) | |
void | aboutToBeDequeued (WeaverInterface *weaver) |
void | aboutToBeQueued (WeaverInterface *weaver) |
bool | canBeExecuted () |
void | execute (Thread *t) |
Job * | payload () |
int | priority () const |
Public Member Functions inherited from ThreadWeaver::Job | |
Job (QObject *parent=0) | |
virtual | ~Job () |
void | assignQueuePolicy (QueuePolicy *) |
bool | isFinished () const |
void | removeQueuePolicy (QueuePolicy *) |
virtual void | requestAbort () |
virtual bool | success () const |
Additional Inherited Members | |
Signals inherited from ThreadWeaver::Job | |
void | done (ThreadWeaver::Job *) |
void | failed (ThreadWeaver::Job *) |
void | started (ThreadWeaver::Job *) |
Protected Member Functions inherited from ThreadWeaver::Job | |
void | freeQueuePolicyResources () |
void | setFinished (bool status) |
Thread * | thread () |
Protected Attributes inherited from ThreadWeaver::Job | |
Private * | d |
Detailed Description
Definition at line 45 of file JobCollection_p.h.
Constructor & Destructor Documentation
JobCollectionJobRunner::JobCollectionJobRunner | ( | JobCollection * | collection, |
Job * | payload, | ||
QObject * | parent | ||
) |
Definition at line 43 of file JobCollection.cpp.
Member Function Documentation
|
virtual |
This Job is about the be dequeued from the weaver's job queue.
The job will be removed from the queue right after this method returns. Use this method to dequeue, if necessary, sub-operations (jobs) that this job has enqueued.
Note: When this method is called, the associated Weaver object's thread does hold a lock on the weaver's queue.
Note: The default implementation does nothing.
- Parameters
-
weaver the Weaver object from which the job will be dequeued
Reimplemented from ThreadWeaver::Job.
Definition at line 73 of file JobCollection.cpp.
|
virtual |
The job is about to be added to the weaver's job queue.
The job will be added right after this method finished. The default implementation does nothing. Use this method to, for example, queue sub-operations as jobs before the job itself is queued.
Note: When this method is called, the associated Weaver object's thread holds a lock on the weaver's queue. Therefore, it is save to assume that recursive queueing is atomic from the queues perspective.
- Parameters
-
weaver the Weaver object the job will be queued in
Reimplemented from ThreadWeaver::Job.
Definition at line 68 of file JobCollection.cpp.
|
virtual |
canBeExecuted() returns true if all the jobs queue policies agree to it.
If it returns true, it expects that the job is executed right after that. The done() methods of the queue policies will be automatically called when the job is finished.
If it returns false, all queue policy resources have been freed, and the method can be called again at a later time.
Reimplemented from ThreadWeaver::Job.
Definition at line 58 of file JobCollection.cpp.
|
virtual |
Perform the job.
The thread in which this job is executed is given as a parameter. Do not overload this method to create your own Job implementation, overload run().
Reimplemented from ThreadWeaver::Job.
Definition at line 78 of file JobCollection.cpp.
Job * JobCollectionJobRunner::payload | ( | ) |
Definition at line 63 of file JobCollection.cpp.
|
virtual |
The queueing priority of the job.
Jobs will be sorted by their queueing priority when enqueued. A higher queueing priority will place the job in front of all lower-priority jobs in the queue.
Note: A higher or lower priority does not influence queue policies. For example, a high-priority job that has an unresolved dependency will not be executed, which means an available lower-priority job will take precedence.
The default implementation returns zero. Only if this method is overloaded for some job classes, priorities will influence the execution order of jobs.
Reimplemented from ThreadWeaver::Job.
Definition at line 90 of file JobCollection.cpp.
The documentation for this class was generated from the following files:
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.