YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
wait_event.hpp
Go to the documentation of this file.
1#pragma once
2
6
7namespace yaclib::detail {
8
9template <typename Derived>
12 return *this;
13 }
14
15 private:
16 template <bool SymmetricTransfer>
17 [[nodiscard]] YACLIB_INLINE auto Impl() noexcept {
18 DownCast<Derived>(*this).Sub(1);
20 }
21 [[nodiscard]] InlineCore* Here(InlineCore& /*caller*/) noexcept final {
22 return Impl<false>();
23 }
24#if YACLIB_SYMMETRIC_TRANSFER != 0
25 [[nodiscard]] yaclib_std::coroutine_handle<> Next(InlineCore& /*caller*/) noexcept final {
26 return Impl<true>();
27 }
28#endif
29};
30
31template <typename Derived>
34 return *this;
35 }
36
37 private:
38 template <bool SymmetricTransfer>
39 [[nodiscard]] YACLIB_INLINE auto Impl(InlineCore& caller) noexcept {
40 caller.DecRef();
41 DownCast<Derived>(*this).Sub(1);
43 }
44 [[nodiscard]] InlineCore* Here(InlineCore& caller) noexcept final {
45 return Impl<false>(caller);
46 }
47#if YACLIB_SYMMETRIC_TRANSFER != 0
48 [[nodiscard]] yaclib_std::coroutine_handle<> Next(InlineCore& caller) noexcept final {
49 return Impl<true>(caller);
50 }
51#endif
52};
53
54template <typename Event, template <typename...> typename Counter, template <typename...> typename... Callbacks>
55struct MultiEvent final : Counter<Event, SetDeleter>, Callbacks<MultiEvent<Event, Counter, Callbacks...>>... {
57};
58
59} // namespace yaclib::detail
virtual void DecRef() noexcept
Decrements reference counter.
Definition ref.hpp:19
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25
CallCallback & GetCall() noexcept
DropCallback & GetDrop() noexcept