YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
unique_core.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace yaclib::detail {
6
7template <typename V, typename E>
8class UniqueCore : public ResultCore<V, E> {
10
11 public:
12 [[nodiscard]] InlineCore* Here(InlineCore& caller) noexcept override {
14 }
15
16#if YACLIB_SYMMETRIC_TRANSFER != 0
17 [[nodiscard]] yaclib_std::coroutine_handle<> Next(InlineCore& caller) noexcept override {
19 }
20#endif
21
25
27 return BaseCore::SetCallbackImpl<false>(callback);
28 }
29
30 // Sometimes we know it will be last callback in cycle, so we want call it right now, instead of SetInline
31 void CallInline(InlineCore& callback) noexcept {
32 if (!SetCallback(callback)) {
33 auto* next = callback.Here(*this);
34 YACLIB_ASSERT(next == nullptr);
35 }
36 }
37
38 template <bool SymmetricTransfer>
40 return BaseCore::SetInlineImpl<SymmetricTransfer, false>(callback);
41 }
42
43 template <bool SymmetricTransfer>
45 return BaseCore::SetResultImpl<SymmetricTransfer, false>();
46 }
47};
48
49extern template class UniqueCore<void, StopError>;
50
51template <typename V, typename E>
53
54} // namespace yaclib::detail
A intrusive pointer to objects with an embedded reference count.
void StoreCallbackImpl(InlineCore &callback) noexcept
Definition base_core.hpp:58
InlineCore * Here(InlineCore &caller) noexcept override
Transfer< SymmetricTransfer > SetResult() noexcept
void StoreCallback(InlineCore &callback) noexcept
void CallInline(InlineCore &callback) noexcept
Transfer< SymmetricTransfer > SetInline(InlineCore &callback) noexcept
bool SetCallback(InlineCore &callback) noexcept
#define YACLIB_ASSERT(cond)
Definition log.hpp:85
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25