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

ThreadWeaver

  • threadweaver
  • Weaver
Job.h
Go to the documentation of this file.
1/* -*- C++ -*-
2
3This file declares the Job class.
4
5$ Author: Mirko Boehm $
6$ Copyright: (C) 2004-2013 Mirko Boehm $
7$ Contact: mirko@kde.org
8http://www.kde.org
9http://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: Job.h 32 2005-08-17 08:38:01Z mirko $
27*/
28
29#ifndef THREADWEAVER_JOB_H
30#define THREADWEAVER_JOB_H
31
32#include <QtCore/QObject>
33
34#include <threadweaver/threadweaver_export.h>
35
36class QMutex;
37class QWaitCondition;
38
39namespace ThreadWeaver {
40
41 class Thread;
42 class QueuePolicy;
43 class JobRunHelper;
44 class WeaverInterface;
45 class QueuePolicyList;
46
64
65 class THREADWEAVER_EXPORT Job : public QObject
66 {
67 Q_OBJECT
68
69 public:
70 friend class JobRunHelper;
71
76 explicit Job ( QObject* parent = 0 );
77
79 virtual ~Job();
80
85 virtual void execute(Thread*);
86
101 virtual int priority() const;
102
118 virtual bool success () const;
119
134 virtual void requestAbort () {}
135
149 virtual void aboutToBeQueued ( WeaverInterface *weaver );
150
164 virtual void aboutToBeDequeued ( WeaverInterface *weaver );
165
174 virtual bool canBeExecuted();
175
177 bool isFinished() const;
178
186 void assignQueuePolicy ( QueuePolicy* );
187
190 void removeQueuePolicy ( QueuePolicy* );
191
192 Q_SIGNALS:
195 void started ( ThreadWeaver::Job* );
201 void done ( ThreadWeaver::Job* );
202
207 void failed( ThreadWeaver::Job* );
208
209 protected:
210 class Private;
211 Private* d;
212
215 void freeQueuePolicyResources();
216
220 virtual void run () = 0;
227 Thread *thread();
228
230 void setFinished ( bool status );
231
233 // QMutex& mutex();
234
235 };
236}
237
238#endif // THREADWEAVER_JOB_H
QObject
ThreadWeaver::JobRunHelper
Definition Job_p.h:39
ThreadWeaver::Job
A Job is a simple abstraction of an action that is to be executed in a thread context.
Definition Job.h:66
ThreadWeaver::Job::done
void done(ThreadWeaver::Job *)
This signal is emitted when the job has been finished (no matter if it succeeded or not).
ThreadWeaver::Job::success
virtual bool success() const
Return whether the Job finished successfully or not.
Definition Job.cpp:144
ThreadWeaver::Job::requestAbort
virtual void requestAbort()
Abort the execution of the job.
Definition Job.h:134
ThreadWeaver::Job::execute
virtual void execute(Thread *)
Perform the job.
Definition Job.cpp:122
ThreadWeaver::Job::run
virtual void run()=0
The method that actually performs the job.
ThreadWeaver::Job::failed
void failed(ThreadWeaver::Job *)
This job has failed.
ThreadWeaver::Job::freeQueuePolicyResources
void freeQueuePolicyResources()
Free the queue policies acquired before this job has been executed.
Definition Job.cpp:149
ThreadWeaver::Job::d
Private * d
Definition Job.h:211
ThreadWeaver::Job::priority
virtual int priority() const
The queueing priority of the job.
Definition Job.cpp:139
ThreadWeaver::Job::started
void started(ThreadWeaver::Job *)
This signal is emitted when this job is being processed by a thread.
ThreadWeaver::Job::Job
Job(QObject *parent=0)
Construct a Job.
Definition Job.cpp:76
ThreadWeaver::Job::thread
Thread * thread()
Return the thread that executes this job.
Definition Job.cpp:225
ThreadWeaver::Job::setFinished
void setFinished(bool status)
Call with status = true to mark this job as done.
Definition Job.cpp:230
ThreadWeaver::Job::JobRunHelper
friend class JobRunHelper
Definition Job.h:70
ThreadWeaver::QueuePolicy
QueuePolicy is an interface for customizations of the queueing behaviour of sets of jobs.
Definition QueuePolicy.h:60
ThreadWeaver::Thread
The class Thread is used to represent the worker threads in the weaver's inventory.
Definition Thread.h:47
ThreadWeaver::WeaverInterface
WeaverInterface provides a common interface for weaver implementations.
Definition WeaverInterface.h:61
ThreadWeaver
Definition DebuggingAids.h:51
threadweaver_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Tue Mar 25 2025 00:00:00 by doxygen 1.13.2 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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