MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
EventAwaiter.cpp
Go to the documentation of this file.
1#include "EventAwaiter.hpp"
2
3namespace MayaFlux::Kriya {
4
11
13{
14 if (auto event = m_source.pop_event(m_filter)) {
15 m_result = *event;
16 return true;
17 }
18 return false;
19}
20
21void EventAwaiter::await_suspend(std::coroutine_handle<> handle)
22{
23 m_handle = handle;
24 m_is_suspended = true;
26}
27
33
35{
36 if (auto event = m_source.pop_event(m_filter)) {
37 m_result = *event;
39 m_is_suspended = false;
40 m_handle.resume();
41 }
42}
43
44}
void try_resume()
Called by EventSource when event arrives.
std::coroutine_handle m_handle
Vruta::EventSource & m_source
void await_suspend(std::coroutine_handle<> handle)
Suspend coroutine, register for event notification.
Core::WindowEvent await_resume()
Resume with event data.
bool await_ready()
Check if event already available.
std::optional< Core::WindowEvent > pop_event(const EventFilter &filter)
Pop event matching filter from queue.
void register_waiter(Kriya::EventAwaiter *awaiter)
void unregister_waiter(Kriya::EventAwaiter *awaiter)
Event data for window and input events.