25 struct Event : std::enable_shared_from_this<Event<T_Device>>
28 Event(internal::concepts::DeviceHandle
auto device, uint32_t
const idx)
29 : m_device(
std::move(device))
38 internal::wait(*
this);
49 return m_idx == other.m_idx && m_device == other.m_device;
54 return !(*
this == other);
62 std::mutex
mutable m_mutex;
64 std::shared_future<void> m_future;
66 std::size_t m_enqueueCount = 0u;
71 std::size_t m_LastReadyEnqueueCount = 0u;
73 friend struct alpaka::internal::GetName;
77 return std::string(
"host::Event id=") + std::to_string(m_idx);
80 friend struct internal::GetNativeHandle;
81 friend struct internal::Enqueue;
82 friend struct alpaka::internal::GetDeviceType;
86 return alpaka::internal::getDeviceKind(*m_device.get());
89 auto getDevice()
const
94 std::shared_ptr<Event> getSharedPtr()
96 return this->shared_from_this();
99 friend struct onHost::internal::GetDevice;
101 friend struct internal::IsEventComplete;
109 bool isReady() noexcept
112 return (m_LastReadyEnqueueCount == m_enqueueCount);
121 bool isEventComplete() noexcept
124 std::lock_guard<std::mutex> lk(m_mutex);
128 friend struct internal::WaitFor;
129 friend struct internal::Wait;
134 std::unique_lock<std::mutex> lk(m_mutex);
135 size_t enqueueCount = m_enqueueCount;
137 while(enqueueCount > m_LastReadyEnqueueCount)
139 auto future = m_future;
146 friend struct alpaka::internal::GetApi;