YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
manual.cpp
Go to the documentation of this file.
3
4namespace yaclib {
5
9
11 return true;
12}
13
14void ManualExecutor::Submit(Job& f) noexcept {
15 _tasks.PushBack(f);
16}
17
19 std::size_t done = 0;
20 while (!_tasks.Empty()) {
21 ++done;
22 auto& task = _tasks.PopFront();
23 static_cast<Job&>(task).Call();
24 }
25 return done;
26}
27
31
32} // namespace yaclib
Callable that can be executed in an IExecutor.
Definition job.hpp:12
Type Tag() const noexcept final
Return type of this executor.
Definition manual.cpp:6
void Submit(Job &f) noexcept final
Submit given job.
Definition manual.cpp:14
bool Alive() const noexcept final
Return true if executor still alive, that means job passed to submit will be Call.
Definition manual.cpp:10
std::size_t Drain() noexcept
Definition manual.cpp:18
bool Empty() const noexcept
Node & PopFront() noexcept
IExecutorPtr MakeManual()
Definition manual.cpp:28
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25