mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
Loading...
Searching...
No Matches
mrs_lib::coro::Event Class Reference

Event that can be used to trigger coroutines. More...

#include <event.hpp>

Public Member Functions

 Event (const Event &)=delete
Event & operator= (const Event &)=delete
 Event (Event &&other) noexcept
Event & operator= (Event &&other) noexcept
bool try_trigger ()
 Try triggering the event.
bool try_cancel ()
 Try cancelling the event.

Friends

std::pair< Event, EventAwaitable > make_event ()
 Create Event and its bound awaitable.

Detailed Description

Event that can be used to trigger coroutines.

This is the write part of a onedirectional oneshot communication channel. To create the pair, use mrs_lib::coro::make_event.

See also
mrs_lib::coro::make_event
mrs_lib::coro::EventAwaitable

Member Function Documentation

◆ try_cancel()

bool mrs_lib::coro::Event::try_cancel ( )

Try cancelling the event.

Returns
true if succeeded, false otherwise

The call will fail (return false) if the event was already triggered or cancelled.

◆ try_trigger()

bool mrs_lib::coro::Event::try_trigger ( )

Try triggering the event.

Returns
true if succeeded, false otherwise

The call will fail (return false) if the event was already triggered or cancelled.

◆ make_event

std::pair< Event, EventAwaitable > make_event ( )
friend

Create Event and its bound awaitable.

Together, the Event and EventAwaitable form a onedirectional oneshot communication channel.

See also
mrs_lib::coro::Event
mrs_lib::coro::EventAwaitable

The documentation for this class was generated from the following files:
  • /home/runner/work/mrs_lib/mrs_lib/include/mrs_lib/coro/event.hpp
  • /home/runner/work/mrs_lib/mrs_lib/src/coro/event.cpp