1 | /* -*- C++ -*- |
---|---|
2 | Class to manipulate job execution in ThreadWeaver. |
3 | |
4 | SPDX-FileCopyrightText: 2005-2013 Mirko Boehm <mirko@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.0-or-later |
7 | */ |
8 | |
9 | #ifndef EXECUTEWRAPPER_H |
10 | #define EXECUTEWRAPPER_H |
11 | |
12 | #include <QAtomicPointer> |
13 | |
14 | #include "executor_p.h" |
15 | #include "job.h" |
16 | |
17 | namespace ThreadWeaver |
18 | { |
19 | class Job; |
20 | class Thread; |
21 | |
22 | // FIXME Pimpl, make part of the API, document |
23 | // Find a way to avoid new/delete operation, this is rather performance sensitive area |
24 | class ExecuteWrapper : public Executor |
25 | { |
26 | public: |
27 | ExecuteWrapper(); |
28 | ~ExecuteWrapper(); |
29 | Executor *wrap(Executor *previous); |
30 | Executor *unwrap(JobInterface *job); |
31 | void begin(const JobPointer &job, Thread *) override; |
32 | void execute(const JobPointer &job, Thread *thread) override; |
33 | void executeWrapped(const JobPointer &job, Thread *thread); |
34 | void end(const JobPointer &job, Thread *) override; |
35 | |
36 | private: |
37 | QAtomicPointer<Executor> wrapped; |
38 | }; |
39 | |
40 | } |
41 | |
42 | #endif // EXECUTEWRAPPER_H |
43 |