ThreadWeaver
JobCollection_p.h
Go to the documentation of this file.
00001 /* -*- C++ -*- 00002 00003 This file implements the JobCollection 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: DebuggingAids.h 30 2005-08-16 16:16:04Z mirko $ 00027 */ 00028 00029 #ifndef THREADWEAVER_JOBCOLLECTION_P_H 00030 #define THREADWEAVER_JOBCOLLECTION_P_H 00031 00032 #include "JobCollection.h" 00033 #include "WeaverInterface.h" 00034 00035 #include <QtCore/QObject> 00036 #include <QtCore/QPointer> 00037 00038 using namespace ThreadWeaver; 00039 00040 /* QPointers are used internally to be able to dequeue jobs at destruction 00041 time. The owner of the jobs could have deleted them in the meantime. 00042 We use a class instead of a typedef to be able to forward-declare the 00043 class in the declaration. 00044 */ 00045 class ThreadWeaver::JobCollectionJobRunner : public Job 00046 { 00047 Q_OBJECT 00048 00049 public: 00050 JobCollectionJobRunner ( JobCollection* collection, Job* payload, QObject* parent ); 00051 00052 bool canBeExecuted(); 00053 00054 Job* payload (); 00055 00056 void aboutToBeQueued ( WeaverInterface *weaver ); 00057 00058 void aboutToBeDequeued ( WeaverInterface *weaver ); 00059 00060 void execute ( Thread *t ); 00061 00062 int priority () const; 00063 00064 private: 00065 void run (); 00066 00067 QPointer<Job> m_payload; 00068 JobCollection* m_collection; 00069 }; 00070 00071 #endif // THREADWEAVER_JOBCOLLECTION_P_H
KDE 4.6 API Reference