• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

ThreadWeaver

  • ThreadWeaver
  • DependencyPolicy
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
ThreadWeaver::DependencyPolicy Class Reference

#include <DependencyPolicy.h>

Inheritance diagram for ThreadWeaver::DependencyPolicy:
Inheritance graph
[legend]

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.

DependencyPolicy::DependencyPolicy ( )
protected

Definition at line 63 of file DependencyPolicy.cpp.

Member Function Documentation

void DependencyPolicy::addDependency ( Job *  jobA,
Job *  jobB 
)

Add jobB as a dependency of jobA.

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

Parameters
jobAthe depending job
jobBthe job jobA depends on

Definition at line 74 of file DependencyPolicy.cpp.

bool DependencyPolicy::canRun ( Job *  )
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.

void DependencyPolicy::destructed ( Job *  )
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.

void DependencyPolicy::free ( Job *  )
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.

QList< Job * > DependencyPolicy::getDependencies ( Job *  job) const

Retrieve a list of dependencies of this job.

Definition at line 128 of file DependencyPolicy.cpp.

bool DependencyPolicy::hasUnresolvedDependencies ( Job *  job) const
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.

DependencyPolicy & DependencyPolicy::instance ( )
static

Definition at line 152 of file DependencyPolicy.cpp.

void DependencyPolicy::release ( Job *  )
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.

bool DependencyPolicy::removeDependency ( Job *  jobA,
Job *  jobB 
)

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
jobAthe depending job
jobBthe 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:
  • DependencyPolicy.h
  • DependencyPolicy.cpp
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

KDE's Doxygen guidelines are available online.

ThreadWeaver

Skip menu "ThreadWeaver"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal