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

ThreadWeaver

Job.h

Go to the documentation of this file.
00001 /* -*- C++ -*-
00002 
00003 This file declares the Job class.
00004 
00005 $ Author: Mirko Boehm $
00006 $ Copyright: (C) 2004, 2005, 2006 Mirko Boehm $
00007 $ Contact: mirko@kde.org
00008 http://www.kde.org
00009 http://www.hackerbuero.org $
00010 
00011    This library is free software; you can redistribute it and/or
00012    modify it under the terms of the GNU Library General Public
00013    License as published by the Free Software Foundation; either
00014    version 2 of the License, or (at your option) any later version.
00015 
00016    This library is distributed in the hope that it will be useful,
00017    but WITHOUT ANY WARRANTY; without even the implied warranty of
00018    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019    Library General Public License for more details.
00020 
00021    You should have received a copy of the GNU Library General Public License
00022    along with this library; see the file COPYING.LIB.  If not, write to
00023    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00024    Boston, MA 02110-1301, USA.
00025 
00026 $Id: Job.h 32 2005-08-17 08:38:01Z mirko $
00027 */
00028 
00029 #ifndef THREADWEAVER_JOB_H
00030 #define THREADWEAVER_JOB_H
00031 
00032 #include <QtCore/QObject>
00033 
00034 #include <threadweaver/threadweaver_export.h>
00035 
00036 class QMutex;
00037 class QWaitCondition;
00038 
00039 namespace ThreadWeaver {
00040 
00041     class Thread;
00042     class QueuePolicy;
00043     class JobRunHelper;
00044     class WeaverInterface;
00045     class QueuePolicyList;
00046 
00062     class THREADWEAVER_EXPORT Job : public QObject
00063     {
00064         Q_OBJECT
00065 
00066     public:
00067         friend class JobRunHelper;
00068 
00073         explicit Job ( QObject* parent = 0 );
00074 
00076         virtual ~Job();
00077 
00082         virtual void execute(Thread*);
00083 
00098         virtual int priority() const;
00099 
00115         virtual bool success () const;
00116 
00131         // FIXME (Mirko) this should be private, I guess?
00132         virtual void requestAbort () {}
00133 
00147         virtual void aboutToBeQueued ( WeaverInterface *weaver );
00148 
00162         virtual void aboutToBeDequeued ( WeaverInterface *weaver );
00163 
00172         virtual bool canBeExecuted();
00173 
00175         bool isFinished() const;
00176 
00184         void assignQueuePolicy ( QueuePolicy* );
00185 
00188         void removeQueuePolicy ( QueuePolicy* );
00189 
00190     Q_SIGNALS:
00193     void started ( ThreadWeaver::Job* );
00195     void done ( ThreadWeaver::Job* );
00196 
00201         void failed( ThreadWeaver::Job* );
00202 
00203     protected:
00204         class Private;
00205         Private* d;
00206 
00209         void freeQueuePolicyResources();
00210 
00214         virtual void run () = 0;
00221         Thread *thread();
00222 
00224         void setFinished ( bool status );
00225 
00227         // QMutex& mutex();
00228 
00229     };
00230 }
00231 
00232 #endif // THREADWEAVER_JOB_H
00233 

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
  •   WTF
  • KJSEmbed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  •   core
  • Phonon
  •   Backend
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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