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 EXECUTOR_H
10#define EXECUTOR_H
11
12#include "job.h"
13
14namespace ThreadWeaver
15{
16class Job;
17class Thread;
18
19// FIXME Pimpl, make part of the API, document
20// TODO can JobPointer references be used?
21class THREADWEAVER_EXPORT Executor
22{
23public:
24 virtual ~Executor();
25 virtual void begin(const JobPointer &, Thread *) = 0;
26 void defaultBegin(const JobPointer &job, Thread *thread);
27 virtual void execute(const JobPointer &, Thread *) = 0;
28 virtual void end(const JobPointer &, Thread *) = 0;
29 void defaultEnd(const JobPointer &job, Thread *thread);
30
31 /// @return true when this executor should be owned by the job and deleted alongside it
32 virtual bool ownedByJob() const
33 {
34 return false;
35 }
36
37 void run(const JobPointer &job, Thread *thread);
38};
39
40}
41
42#endif // EXECUTOR_H
43

source code of threadweaver/src/executor_p.h