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

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 EXECUTOR_H
0010 #define EXECUTOR_H
0011 
0012 #include "job.h"
0013 
0014 namespace ThreadWeaver
0015 {
0016 class Job;
0017 class Thread;
0018 
0019 // FIXME Pimpl, make part of the API, document
0020 // TODO can JobPointer references be used?
0021 class THREADWEAVER_EXPORT Executor
0022 {
0023 public:
0024     virtual ~Executor();
0025     virtual void begin(const JobPointer &, Thread *) = 0;
0026     void defaultBegin(const JobPointer &job, Thread *thread);
0027     virtual void execute(const JobPointer &, Thread *) = 0;
0028     virtual void end(const JobPointer &, Thread *) = 0;
0029     void defaultEnd(const JobPointer &job, Thread *thread);
0030     virtual void cleanup(const JobPointer &, Thread *);
0031 
0032     void run(const JobPointer &job, Thread *thread);
0033 };
0034 
0035 }
0036 
0037 #endif // EXECUTOR_H