ThreadWeaver
#include <DependencyPolicy.h>
Public Member Functions | |
~DependencyPolicy () | |
void | addDependency (Job *jobA, Job *jobB) |
bool | canRun (Job *) |
void | destructed (Job *) |
void | dumpJobDependencies () |
void | free (Job *) |
QList< Job * > | getDependencies (Job *) const |
void | release (Job *) |
bool | removeDependency (Job *jobA, Job *jobB) |
void | resolveDependencies (Job *) |
Public Member Functions inherited from ThreadWeaver::QueuePolicy | |
virtual | ~QueuePolicy () |
Static Public Member Functions | |
static DependencyPolicy & | instance () |
Protected Member Functions | |
DependencyPolicy () | |
bool | hasUnresolvedDependencies (Job *) const |
Detailed Description
DependencyPolicy implements the way dependencies between Jobs are handled.
To declare that Job B can only be executed when Job A is finished, call addDependency.
Be aware of circular dependencies. All dependencies on a Job will be removed if the Job object is destructed.
JobSequence uses dependencies to implement the ordered execution of the sequence elements.
Definition at line 49 of file DependencyPolicy.h.
Constructor & Destructor Documentation
DependencyPolicy::~DependencyPolicy | ( | ) |
Destructor.
Definition at line 69 of file DependencyPolicy.cpp.
|
protected |
Definition at line 63 of file DependencyPolicy.cpp.
Member Function Documentation
Add jobB as a dependency of jobA.
jobA will only be executed after jobB has been successfully processed.
- Parameters
-
jobA the depending job jobB the job jobA depends on
Definition at line 74 of file DependencyPolicy.cpp.
|
virtual |
canRun() is called before the job is executed.
The job will only be executed if canRun() returns true.
Implements ThreadWeaver::QueuePolicy.
Definition at line 158 of file DependencyPolicy.cpp.
|
virtual |
destructing() is called when a Job that has this queue policy assigned gets destructed.
Implements ThreadWeaver::QueuePolicy.
Definition at line 183 of file DependencyPolicy.cpp.
void DependencyPolicy::dumpJobDependencies | ( | ) |
This method should be useful for debugging purposes.
Definition at line 189 of file DependencyPolicy.cpp.
|
virtual |
free() is called after the job has been executed.
It is guaranteed that free is called only after canRun() returned true at an earlier time.
Implements ThreadWeaver::QueuePolicy.
Definition at line 164 of file DependencyPolicy.cpp.
Retrieve a list of dependencies of this job.
Definition at line 128 of file DependencyPolicy.cpp.
|
protected |
Query whether the job has an unresolved dependency.
In case it does, the policy will return false from canRun().
Definition at line 145 of file DependencyPolicy.cpp.
|
static |
Definition at line 152 of file DependencyPolicy.cpp.
|
virtual |
release() is called if canRun() returned true, but the job has not been executed for external reasons.
For example, a second QueuePolicy could have returned false from canRun() for the same job.
Implements ThreadWeaver::QueuePolicy.
Definition at line 178 of file DependencyPolicy.cpp.
Remove dependency.
The dependency of jobA on jobB is removed. If no dependencies are left for jobA, canRun will return true.
Returns false if the given object is not dependency of this job.
This function is inefficient, and should be used only to abort execution of a job.
- Parameters
-
jobA the depending job jobB the job jobA depends on
- Returns
- true if dependency existed, false otherwise
Definition at line 87 of file DependencyPolicy.cpp.
void DependencyPolicy::resolveDependencies | ( | Job * | job | ) |
Resolve all dependencies.
This method is called after the Job has been finished, or when it is deleted without being executed (performed by the destructor). The method will remove all entries stating that another Job depends on this one.
Definition at line 110 of file DependencyPolicy.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:33 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.