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

ThreadWeaver

  • sources
  • kde-4.12
  • kdelibs
  • threadweaver
  • Weaver
JobSequence.cpp
Go to the documentation of this file.
1 /* -*- C++ -*-
2 
3  This file implements the JobSequence class.
4 
5  $ Author: Mirko Boehm $
6  $ Copyright: (C) 2004-2013 Mirko Boehm $
7  $ Contact: mirko@kde.org
8  http://www.kde.org
9  http://creative-destruction.me $
10 
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Library General Public
13  License as published by the Free Software Foundation; either
14  version 2 of the License, or (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Library General Public License for more details.
20 
21  You should have received a copy of the GNU Library General Public License
22  along with this library; see the file COPYING.LIB. If not, write to
23  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24  Boston, MA 02110-1301, USA.
25 
26  $Id: DebuggingAids.h 30 2005-08-16 16:16:04Z mirko $
27 */
28 
29 #include "JobSequence.h"
30 #include "WeaverInterface.h"
31 #include "DebuggingAids.h"
32 #include "DependencyPolicy.h"
33 
34 using namespace ThreadWeaver;
35 
36 JobSequence::JobSequence ( QObject *parent )
37  : JobCollection ( parent ), d ( 0 )
38 {
39 }
40 
41 void JobSequence::aboutToBeQueued ( WeaverInterface *weaver )
42 {
43  REQUIRE (weaver != 0);
44 
45  if ( jobListLength() > 1 )
46  {
47  // set up the dependencies:
48  for ( int i = 1; i < jobListLength(); ++i )
49  {
50  Job* jobA = jobAt(i);
51  Job* jobB = jobAt(i-1);
52  P_ASSERT ( jobA != 0 );
53  P_ASSERT ( jobB != 0 );
54  DependencyPolicy::instance().addDependency ( jobA, jobB );
55  }
56  }
57 
58  JobCollection::aboutToBeQueued( weaver );
59 }
60 
61 void JobSequence::internalJobDone( Job* job)
62 {
63  REQUIRE ( job != 0 );
64 
65  if ( !job->success() )
66  {
67  stop( job );
68  }
69 
70  JobCollection::internalJobDone(job);
71 }
72 
73 #include "JobSequence.moc"
DependencyPolicy.h
ThreadWeaver::DependencyPolicy::addDependency
void addDependency(Job *jobA, Job *jobB)
Add jobB as a dependency of jobA.
Definition: DependencyPolicy.cpp:74
ThreadWeaver::JobCollection::internalJobDone
virtual void internalJobDone(Job *)
Callback method for done jobs.
Definition: JobCollection.cpp:302
ThreadWeaver::JobCollection::jobListLength
const int jobListLength()
Return the number of jobs in the joblist.
Definition: JobCollection.cpp:246
ThreadWeaver::DependencyPolicy::instance
static DependencyPolicy & instance()
Definition: DependencyPolicy.cpp:152
QObject
ThreadWeaver::JobSequence::JobSequence
JobSequence(QObject *parent=0)
Definition: JobSequence.cpp:36
ThreadWeaver::Job::success
virtual bool success() const
Return whether the Job finished successfully or not.
Definition: Job.cpp:144
JobSequence.h
REQUIRE
#define REQUIRE(x)
Definition: DebuggingAids.h:146
P_ASSERT
#define P_ASSERT(x)
P_ASSERT ensures that error messages occur in the correct order.
Definition: DebuggingAids.h:103
DebuggingAids.h
ThreadWeaver::JobCollection::stop
void stop(ThreadWeaver::Job *job)
Stop processing, dequeue all remaining Jobs.
Definition: JobCollection.cpp:155
ThreadWeaver::JobSequence::internalJobDone
void internalJobDone(Job *)
reimplemented
Definition: JobSequence.cpp:61
ThreadWeaver::JobCollection::aboutToBeQueued
void aboutToBeQueued(WeaverInterface *weaver)
Overload to queue the collection.
Definition: JobCollection.cpp:167
ThreadWeaver::JobCollection::jobAt
Job * jobAt(int i)
Return a reference to the job in the job list at position i.
Definition: JobCollection.cpp:239
ThreadWeaver::WeaverInterface
WeaverInterface provides a common interface for weaver implementations.
Definition: WeaverInterface.h:61
WeaverInterface.h
ThreadWeaver::JobCollection
A JobCollection is a vector of Jobs that will be queued together.
Definition: JobCollection.h:49
ThreadWeaver::Job
A Job is a simple abstraction of an action that is to be executed in a thread context.
Definition: Job.h:65
ThreadWeaver::JobSequence::aboutToBeQueued
void aboutToBeQueued(WeaverInterface *weaver)
Overload to queue the sequence.
Definition: JobSequence.cpp:41
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