Search for usage in LXR

#include <dependencypolicy.h>

Inheritance diagram for ThreadWeaver::DependencyPolicy:

Public Member Functions

 ~DependencyPolicy () override
void addDependency (const Dependency &dep)
void addDependency (JobPointer jobA, JobPointer jobB)
bool canRun (JobPointer) override
void destructed (JobInterface *job) override
void free (JobPointer) override
bool isEmpty () const
void release (JobPointer) override
bool removeDependency (const Dependency &dep)
bool removeDependency (JobPointer jobA, JobPointer jobB)
void resolveDependencies (JobPointer)

Static Public Member Functions

static DependencyPolicyinstance ()

Protected Member Functions

bool hasUnresolvedDependencies (JobPointer) const

Detailed Description

DependencyPolicy implements execution-time dependencies dependencies between Jobs.

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. Sequence uses dependencies to implement the ordered execution of the sequence elements.

Definition at line 32 of file dependencypolicy.h.

Constructor & Destructor Documentation

◆ ~DependencyPolicy()

DependencyPolicy::~DependencyPolicy ( )


Definition at line 54 of file dependencypolicy.cpp.

Member Function Documentation

◆ addDependency()

void DependencyPolicy::addDependency ( JobPointer  jobA,
JobPointer  jobB 

Add jobB as a dependency of jobA.

jobA will only be executed after jobB has been successfully processed.

jobAthe depending job
jobBthe job jobA depends on

Definition at line 59 of file dependencypolicy.cpp.

◆ canRun()

bool DependencyPolicy::canRun ( JobPointer  )

canRun() is called before the job is executed.

The job will only be executed if canRun() returns true.

Implements ThreadWeaver::QueuePolicy.

Definition at line 166 of file dependencypolicy.cpp.

◆ destructed()

void DependencyPolicy::destructed ( JobInterface *  job)

destructing() is called when a Job that has this queue policy assigned gets destructed.

Implements ThreadWeaver::QueuePolicy.

Definition at line 191 of file dependencypolicy.cpp.

◆ free()

void DependencyPolicy::free ( JobPointer  )

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 172 of file dependencypolicy.cpp.

◆ hasUnresolvedDependencies()

bool DependencyPolicy::hasUnresolvedDependencies ( JobPointer  job) const

Query whether the job has an unresolved dependency.

In case it does, the policy will return false from canRun().

Definition at line 147 of file dependencypolicy.cpp.

◆ release()

void DependencyPolicy::release ( JobPointer  )

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 185 of file dependencypolicy.cpp.

◆ removeDependency()

bool DependencyPolicy::removeDependency ( JobPointer  jobA,
JobPointer  jobB 

Remove a 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.

jobAthe depending job
jobBthe job jobA depends on
true if dependency existed, false otherwise

Definition at line 79 of file dependencypolicy.cpp.

◆ resolveDependencies()

void DependencyPolicy::resolveDependencies ( JobPointer  job)

Resolve all dependencies for a job.

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:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Dec 4 2022 04:06:48 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.