YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
submit.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
yaclib/exe/detail/unique_job.hpp
>
4
#include <
yaclib/exe/executor.hpp
>
5
6
#include <utility>
7
8
namespace
yaclib
{
9
10
/**
11
* Submit given func for details \see Submit
12
*
13
* This method creates Job with one allocation and call Submit(Job)
14
* \param f func to execute
15
*/
16
template
<
typename
Func>
17
void
Submit
(
IExecutor
&
executor
,
Func
&&
f
) {
18
static_assert
(!std::is_base_of_v<Job, std::decay_t<Func>>,
"Please use executor.Submit(job)"
);
19
auto
* job =
detail::MakeUniqueJob
(std::forward<Func>(
f
));
20
executor
.Submit(*job);
21
}
22
23
}
// namespace yaclib
yaclib::IExecutor
Definition
executor.hpp:8
executor.hpp
yaclib::detail::MakeUniqueJob
Job * MakeUniqueJob(Func &&f)
Definition
unique_job.hpp:32
yaclib
Definition
base_core.hpp:18
yaclib::Submit
void Submit(IExecutor &executor, Func &&f)
Submit given func for details.
Definition
submit.hpp:17
yaclib::MakeContract
Contract< V, E > MakeContract()
Creates related future and promise.
Definition
contract.hpp:25
unique_job.hpp
include
yaclib
exe
submit.hpp
Generated by
1.9.8