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

ThreadWeaver

ThreadWeaver::DependencyPolicy

ThreadWeaver::DependencyPolicy Class Reference

DependencyPolicy implements the way dependencies between Jobs are handled. More...

#include <DependencyPolicy.h>

Inheritance diagram for ThreadWeaver::DependencyPolicy:
ThreadWeaver::QueuePolicy

List of all members.

Public Member Functions

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 *)
 ~DependencyPolicy ()

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:
jobA the depending job
jobB the 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:
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:
  • DependencyPolicy.h
  • DependencyPolicy.cpp

ThreadWeaver

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal