File indexing completed on 2024-04-21 04:01:27
0001 /* -*- C++ -*- 0002 Class to manipulate job execution in 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 EXECUTEWRAPPER_H 0010 #define EXECUTEWRAPPER_H 0011 0012 #include <QAtomicPointer> 0013 0014 #include "executor_p.h" 0015 #include "job.h" 0016 0017 namespace ThreadWeaver 0018 { 0019 class Job; 0020 class Thread; 0021 0022 // FIXME Pimpl, make part of the API, document 0023 // Find a way to avoid new/delete operation, this is rather performance sensitive area 0024 class ExecuteWrapper : public Executor 0025 { 0026 public: 0027 ExecuteWrapper(); 0028 ~ExecuteWrapper(); 0029 Executor *wrap(Executor *previous); 0030 Executor *unwrap(JobInterface *job); 0031 void begin(const JobPointer &job, Thread *) override; 0032 void execute(const JobPointer &job, Thread *thread) override; 0033 void executeWrapped(const JobPointer &job, Thread *thread); 0034 void end(const JobPointer &job, Thread *) override; 0035 0036 private: 0037 QAtomicPointer<Executor> wrapped; 0038 }; 0039 0040 } 0041 0042 #endif // EXECUTEWRAPPER_H