YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
executor.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <yaclib/exe/job.hpp>
5
6namespace yaclib {
7
8class IExecutor : public IRef {
9 public:
10 /**
11 * Executor tag
12 *
13 * TODO(kononovk) add description
14 * \enum
15 * Custom
16 * Inline
17 * Manual
18 * Strand
19 * SingleThread
20 * FairThreadPool
21 * GolangThreadPool
22 */
23 enum class Type : unsigned char {
24 Custom = 0,
25 Inline = 1,
26 Manual = 2,
27 Strand = 3,
28 SingleThread = 4,
31 };
32
33 /**
34 * Return type of this executor
35 */
36 [[nodiscard]] virtual Type Tag() const noexcept = 0;
37
38 /**
39 * Return true if executor still alive, that means job passed to submit will be Call
40 */
42
43 /**
44 * Submit given job. This method may either Call or Drop the job
45 *
46 * This method increments reference counter if task is submitted.
47 *
48 * Call if executor is Alive, otherwise Drop
49 * \param job job to execute
50 */
51 virtual void Submit(Job& job) noexcept = 0;
52};
53
55
56} // namespace yaclib
TODO(kononovk) Doxygen docs.
virtual Type Tag() const noexcept=0
Return type of this executor.
virtual bool Alive() const noexcept=0
Return true if executor still alive, that means job passed to submit will be Call.
virtual void Submit(Job &job) noexcept=0
Submit given job.
Reference counting interface.
Definition ref.hpp:8
Callable that can be executed in an IExecutor.
Definition job.hpp:12
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25