7 return Event { std::coroutine_handle<event_promise>::from_promise(*
this) };
14 throw std::invalid_argument(
"Invalid coroutine handle");
43 : m_handle(std::exchange(other.m_handle, {}))
50 if (m_handle && m_handle.address())
53 m_handle = std::exchange(other.m_handle, {});
69 return m_handle.promise().processing_token;
83 m_handle.promise().state[key] = std::move(value);
93 auto& state_map =
m_handle.promise().state;
94 auto it = state_map.find(key);
95 if (it != state_map.end()) {
virtual ProcessingToken get_processing_token() const
Get the processing token that determines how this routine should be scheduled.
virtual bool is_active() const
Checks if the coroutine is still active.
virtual ~Event()
Destructor.
virtual void * get_state_impl_raw(const std::string &key)
std::coroutine_handle< promise_type > m_handle
Event & operator=(const Event &other)
Copy assignment operator.
Event(std::coroutine_handle< promise_type > h)
Constructs a Event from a coroutine handle.
virtual void set_state_impl(const std::string &key, std::any value)
std::coroutine_handle< promise_type > get_handle() const
Coroutine type for event-driven suspension.
@ ON_DEMAND
Coroutine is executed on demand, not scheduled.
Event get_return_object()