19template <
typename Event>
27 return event->GetCall().
Here(caller);
32#if YACLIB_SYMMETRIC_TRANSFER != 0
34 return event->GetCall().Next(caller);
41template <
typename Event,
size_t SharedCount>
52template <
typename Event>
64 static_assert(
sizeof...(handles) >= 2,
"Number of futures must be at least two");
66 if constexpr (!Event::kShared) {
68 return handle.SetCallback(event);
74 return handle.SetCallback(event);
83 event.count.fetch_sub(
sizeof...(
handles) -
wait_count, std::memory_order_relaxed);
86template <
typename Event,
typename It>
89 for (std::size_t
i = 0;
i != count; ++
i) {
91 if constexpr (std::is_same_v<
decltype(
it->GetHandle()),
UniqueHandle>) {
92 wait_count +=
static_cast<std::size_t
>(
it->GetHandle().SetCallback(event));
94 wait_count +=
static_cast<std::size_t
>(
it->GetHandle().SetCallback(event.callbacks[
i]));
98 event.count.fetch_sub(count -
wait_count, std::memory_order_relaxed);
virtual InlineCore * Here(InlineCore &caller) noexcept=0
#define YACLIB_ASSERT(cond)
void SetCallbacksStatic(Event &event, Handles... handles)
void SetCallbacksDynamic(Event &event, It it, std::size_t count)
Contract< V, E > MakeContract()
Creates related future and promise.
std::vector< EventHelperCallback< Event > > callbacks
static constexpr bool kShared
DynamicSharedEvent(size_t total_count)
EventHelperCallback()=default
EventHelperCallback(Event *event)
InlineCore * Here(InlineCore &caller) noexcept
std::array< EventHelperCallback< Event >, SharedCount > callbacks
StaticSharedEvent(size_t total_count)
static constexpr bool kShared