YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
inline.cpp
Go to the documentation of this file.
1
#include <
yaclib/exe/executor.hpp
>
2
#include <
yaclib/exe/inline.hpp
>
3
#include <
yaclib/exe/job.hpp
>
4
5
namespace
yaclib
{
6
namespace
{
7
8
template
<
bool
Stopped>
9
class
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
29
static
Inline<false>
sCallInline
;
30
static
Inline<true>
sDropInline
;
31
32
}
// namespace
33
34
IExecutor
&
MakeInline
()
noexcept
{
35
return
sCallInline
;
36
}
37
38
IExecutor
&
MakeInline
(
StopTag
)
noexcept
{
39
return
sDropInline
;
40
}
41
42
}
// namespace yaclib
yaclib::IExecutor
Definition
executor.hpp:8
executor.hpp
inline.hpp
job.hpp
yaclib::detail::Tag
constexpr char Tag() noexcept
Definition
core.hpp:236
yaclib::detail::CallbackType::Inline
@ Inline
yaclib
Definition
base_core.hpp:18
yaclib::Submit
void Submit(IExecutor &executor, Func &&f)
Submit given func for details.
Definition
submit.hpp:17
yaclib::MakeInline
IExecutor & MakeInline() noexcept
Get Inline executor singleton object.
Definition
inline.cpp:34
yaclib::MakeContract
Contract< V, E > MakeContract()
Creates related future and promise.
Definition
contract.hpp:25
src
exe
inline.cpp
Generated by
1.9.8