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
7
8namespace yaclib::detail {
9
10template <typename Derived>
13 return *this;
14 }
15
16 private:
17 template <bool SymmetricTransfer>
18 [[nodiscard]] YACLIB_INLINE auto Impl() noexcept {
19 DownCast<Derived>(*this).Sub(1);
21 }
22
23 public:
24 [[nodiscard]] InlineCore* Here(InlineCore& /*caller*/) noexcept final {
25 return Impl<false>();
26 }
27
28#if YACLIB_SYMMETRIC_TRANSFER != 0
29 [[nodiscard]] yaclib_std::coroutine_handle<> Next(InlineCore& /*caller*/) noexcept final {
30 return Impl<true>();
31 }
32#endif
33};
34
35template <typename Derived>
38 return *this;
39 }
40
41 private:
42 template <bool SymmetricTransfer>
43 [[nodiscard]] YACLIB_INLINE auto Impl(InlineCore& caller) noexcept {
44 caller.DecRef();
45 DownCast<Derived>(*this).Sub(1);
47 }
48
49 public:
50 [[nodiscard]] InlineCore* Here(InlineCore& caller) noexcept final {
51 return Impl<false>(caller);
52 }
53
54#if YACLIB_SYMMETRIC_TRANSFER != 0
55 [[nodiscard]] yaclib_std::coroutine_handle<> Next(InlineCore& caller) noexcept final {
56 return Impl<true>(caller);
57 }
58#endif
59};
60
61template <typename Event, template <typename...> typename Counter, template <typename...> typename... Callbacks>
62struct MultiEvent : Counter<Event, SetDeleter>, Callbacks<MultiEvent<Event, Counter, Callbacks...>>... {
63 static constexpr bool kShared = false;
65};
66
67} // namespace yaclib::detail
virtual void DecRef() noexcept
Decrements reference counter.
Definition ref.hpp:23
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25
CallCallback & GetCall() noexcept
InlineCore * Here(InlineCore &) noexcept final
InlineCore * Here(InlineCore &caller) noexcept final
DropCallback & GetDrop() noexcept
static constexpr bool kShared