File indexing completed on 2024-04-28 15:34:51

0001 /* -*- C++ -*-
0002     This file is part of ThreadWeaver.
0003 
0004     SPDX-FileCopyrightText: 2005-2013 Mirko Boehm <mirko@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef JOB_P_H
0010 #define JOB_P_H
0011 
0012 #include "executewrapper_p.h"
0013 #include <QList>
0014 #include <QMutex>
0015 
0016 namespace ThreadWeaver
0017 {
0018 namespace Private
0019 {
0020 class THREADWEAVER_EXPORT DefaultExecutor : public ThreadWeaver::Executor
0021 {
0022 public:
0023     void begin(const JobPointer &job, Thread *thread) override;
0024     void execute(const JobPointer &job, Thread *thread) override;
0025     void end(const JobPointer &job, Thread *thread) override;
0026 };
0027 
0028 extern DefaultExecutor defaultExecutor;
0029 
0030 class DebugExecuteWrapper : public ThreadWeaver::ExecuteWrapper
0031 {
0032 public:
0033     void execute(const JobPointer &job, ThreadWeaver::Thread *th) override;
0034 };
0035 
0036 class Job_Private
0037 {
0038 public:
0039     Job_Private();
0040     virtual ~Job_Private();
0041 
0042     /** Free the queue policies acquired before this job has been executed. */
0043     virtual void freeQueuePolicyResources(JobPointer);
0044 
0045     /* The list of QueuePolicies assigned to this Job. */
0046     QList<QueuePolicy *> queuePolicies;
0047 
0048     mutable QMutex mutex;
0049     /* @brief The status of the Job. */
0050     QAtomicInt status;
0051 
0052     /** The Executor that will execute this Job. */
0053     QAtomicPointer<Executor> executor;
0054 
0055     // FIXME What is the correct KDE frameworks no debug switch?
0056 #if !defined(NDEBUG)
0057     /** DebugExecuteWrapper for logging of Job execution. */
0058     DebugExecuteWrapper debugExecuteWrapper;
0059 #endif
0060 };
0061 
0062 }
0063 
0064 }
0065 
0066 #endif // JOB_P_H