CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::AsyncManualResetEvent Class Reference

An async manual-reset event is a coroutine synchronisation abstraction that allows one or more coroutines to wait until some thread calls set() on the event. More...

#include <CeresEngine/Foundation/Threading/AsyncEvent.hpp>

Classes

class  Operation
 

Public Member Functions

 AsyncManualResetEvent (bool initiallySet=false) noexcept
 Initialise the event to either 'set' or 'not set' state.
 
 ~AsyncManualResetEvent ()
 
Operation operator co_await () const noexcept
 Wait for the event to enter the 'set' state.
 
bool isSet () const noexcept
 Query if the event is currently in the 'set' state.
 
void set () noexcept
 Set the state of the event to 'set'.
 
void reset () noexcept
 Set the state of the event to 'not-set'.
 

Private Attributes

Atomic< void * > mState
 

Friends

class Operation
 

Detailed Description

An async manual-reset event is a coroutine synchronisation abstraction that allows one or more coroutines to wait until some thread calls set() on the event.

When a coroutine awaits a 'set' event the coroutine continues without suspending. Otherwise, if it awaits a 'not set' event the coroutine is suspended and is later resumed inside the call to 'set()'.

\seealso AsyncAutoResetEvent

Constructor & Destructor Documentation

◆ AsyncManualResetEvent()

CeresEngine::AsyncManualResetEvent::AsyncManualResetEvent ( bool  initiallySet = false)
noexcept

Initialise the event to either 'set' or 'not set' state.

Parameters
initiallySetIf 'true' then initialises the event to the 'set' state, otherwise initialises the event to the 'not set' state.

◆ ~AsyncManualResetEvent()

CeresEngine::AsyncManualResetEvent::~AsyncManualResetEvent ( )

Member Function Documentation

◆ isSet()

bool CeresEngine::AsyncManualResetEvent::isSet ( ) const
noexcept

Query if the event is currently in the 'set' state.

◆ operator co_await()

Operation CeresEngine::AsyncManualResetEvent::operator co_await ( ) const
noexcept

Wait for the event to enter the 'set' state.

If the event is already 'set' then the coroutine continues without suspending.

Otherwise, the coroutine is suspended and later resumed when some thread calls 'set()'. The coroutine will be resumed inside the next call to 'set()'.

◆ reset()

void CeresEngine::AsyncManualResetEvent::reset ( )
noexcept

Set the state of the event to 'not-set'.

Any coroutines that subsequently await the event will suspend until some thread calls 'set()'.

This is a no-op if the state was already 'not set'.

◆ set()

void CeresEngine::AsyncManualResetEvent::set ( )
noexcept

Set the state of the event to 'set'.

If there are pending coroutines awaiting the event then all pending coroutines are resumed within this call. Any coroutines that subsequently await the event will continue without suspending.

This operation is a no-op if the event was already 'set'.

Friends And Related Symbol Documentation

◆ Operation

Member Data Documentation

◆ mState

Atomic<void*> CeresEngine::AsyncManualResetEvent::mState
mutableprivate

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