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

Internal awaitable used to wait for events. More...

#include <event.hpp>

Classes

class  Awaiter
 

Public Types

enum class  StopTokenBehavior { respect , ignore }
 

Public Member Functions

 LowLevelEventAwaitable (const LowLevelEventAwaitable &)=delete
 
LowLevelEventAwaitableoperator= (const LowLevelEventAwaitable &)=delete
 
 LowLevelEventAwaitable (LowLevelEventAwaitable &&other) noexcept
 
LowLevelEventAwaitableoperator= (LowLevelEventAwaitable &&other) noexcept
 
ImmediateAwaitable< Awaiterget_awaitable () &&
 Create awaitable for this event with default configuration.
 
ImmediateAwaitable< Awaiterget_awaitable (StopTokenBehavior stop_token_behavior, std::function< void()> callback) &&
 Create awaitable for this event.
 

Friends

std::pair< Event, EventAwaitablemrs_lib::coro::make_event ()
 

Detailed Description

Internal awaitable used to wait for events.

This should likely not be used outside of coroutine library functions.

Member Function Documentation

◆ get_awaitable()

auto mrs_lib::coro::internal::LowLevelEventAwaitable::get_awaitable ( StopTokenBehavior  stop_token_behavior,
std::function< void()>  callback 
) &&

Create awaitable for this event.

Parameters
stop_token_behaviorWhether to respect stop token request to cancel the await.
callbackCallback to run during suspend.

The callback is only run if the coroutine is suspended.

The callback can be used to register a waker that will start the coroutine once ready.

Warning
The passed function should not reference local state of the coroutine as it may be destroyed during the callback execution.

The documentation for this class was generated from the following files: