YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
inline_core.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <yaclib/config.hpp>
4#include <yaclib/exe/job.hpp>
5#include <yaclib/log.hpp>
6
7#if YACLIB_SYMMETRIC_TRANSFER != 0
8# include <yaclib/coro/coro.hpp>
9#endif
10
11namespace yaclib::detail {
12
13class InlineCore : public Job {
14 public:
15 [[nodiscard]] virtual InlineCore* Here(InlineCore& caller) noexcept = 0;
16
17#if YACLIB_SYMMETRIC_TRANSFER != 0
18 [[nodiscard]] virtual yaclib_std::coroutine_handle<> Next(InlineCore& caller) noexcept = 0;
19#endif
20};
21
22template <bool SymmetricTransfer>
24#if YACLIB_SYMMETRIC_TRANSFER != 0
25 if constexpr (SymmetricTransfer) {
26 return callback.Next(caller);
27 } else
28#endif
29 {
30 return &callback;
31 }
32}
33
34template <bool SymmetricTransfer>
36#if YACLIB_SYMMETRIC_TRANSFER != 0
37 if constexpr (SymmetricTransfer) {
38 return yaclib_std::coroutine_handle<>{yaclib_std::noop_coroutine()};
39 } else
40#endif
41 {
42 return static_cast<InlineCore*>(nullptr);
43 }
44}
45
46} // namespace yaclib::detail
Callable that can be executed in an IExecutor.
Definition job.hpp:12
virtual InlineCore * Here(InlineCore &caller) noexcept=0
YACLIB_INLINE auto Step(InlineCore &caller, InlineCore &callback) noexcept
YACLIB_INLINE auto Noop() noexcept
constexpr yaclib_std::coroutine_handle noop_coroutine() noexcept
Definition coro.hpp:49
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25