YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
inline.cpp
Go to the documentation of this file.
3#include <yaclib/exe/job.hpp>
4
5namespace yaclib {
6namespace {
7
8template <bool Stopped>
9class Inline final : public IExecutor {
10 private:
11 [[nodiscard]] Type Tag() const noexcept final {
12 return Type::Inline;
13 }
14
15 [[nodiscard]] bool Alive() const noexcept final {
16 return !Stopped;
17 }
18
19 void Submit(Job& task) noexcept final {
20 if constexpr (Stopped) {
21 task.Drop();
22 } else {
23 task.Call();
24 }
25 }
26};
27
28// TODO(MBkkt) Make file with depended globals
31
32} // namespace
33
37
39 return sDropInline;
40}
41
42} // namespace yaclib
constexpr char Tag() noexcept
Definition core.hpp:236
void Submit(IExecutor &executor, Func &&f)
Submit given func for details.
Definition submit.hpp:17
IExecutor & MakeInline() noexcept
Get Inline executor singleton object.
Definition inline.cpp:34
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25