YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
shared_core.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace yaclib::detail {
6
7template <typename V, typename E>
8class SharedCore : 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
23 return BaseCore::SetCallbackImpl<true>(callback);
24 }
25
26 // Users should be cautious calling SetInline on a SharedCore
27 // because the core's lifetime is managed by the SharedPromise and
28 // SharedFutures and they might all be gone by the time
29 // the callback is called
30 template <bool SymmetricTransfer>
32 return BaseCore::SetInlineImpl<SymmetricTransfer, true>(callback);
33 }
34
35 template <bool SymmetricTransfer>
37 return BaseCore::SetResultImpl<SymmetricTransfer, true>();
38 }
39};
40
41extern template class SharedCore<void, StopError>;
42
43template <typename V, typename E>
45
46} // namespace yaclib::detail
A intrusive pointer to objects with an embedded reference count.
InlineCore * Here(InlineCore &caller) noexcept override
Transfer< SymmetricTransfer > SetResult() noexcept
bool SetCallback(InlineCore &callback) noexcept
Transfer< SymmetricTransfer > SetInline(InlineCore &callback) noexcept
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25