Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
FutureSharedStateDetail::Receiver< ResultType > Class Template Reference

Responsible for syncronization between the task and the receiving thread. More...

#include <Future.h>

Public Member Functions

 Receiver ()=default
 
 ~Receiver ()
 
 Receiver (const Receiver &)=delete
 
 Receiver (Receiver &&)=delete
 
bool IsDone () const noexcept
 
void Wait ()
 
void RequestStop () noexcept
 Request the executing thread to stop as fast as possible. More...
 
ResultType GetResult ()
 Move the result away from the shared state, mark the future invalid. More...
 

Public Attributes

std::atomic< bool > m_Done {false}
 
std::atomic< bool > m_StopRequest {false}
 
std::mutex m_Mutex
 
std::condition_variable m_ConditionVariable
 
std::variant< std::exception_ptr, NonVoid< ResultType > > m_Outcome
 

Detailed Description

template<typename ResultType>
class FutureSharedStateDetail::Receiver< ResultType >

Responsible for syncronization between the task and the receiving thread.

Constructor & Destructor Documentation

◆ Receiver() [1/3]

template<typename ResultType >
FutureSharedStateDetail::Receiver< ResultType >::Receiver ( )
default

◆ ~Receiver()

template<typename ResultType >
FutureSharedStateDetail::Receiver< ResultType >::~Receiver ( )
inline

◆ Receiver() [2/3]

template<typename ResultType >
FutureSharedStateDetail::Receiver< ResultType >::Receiver ( const Receiver< ResultType > &  )
delete

◆ Receiver() [3/3]

template<typename ResultType >
FutureSharedStateDetail::Receiver< ResultType >::Receiver ( Receiver< ResultType > &&  )
delete

Member Function Documentation

◆ GetResult()

template<typename ResultType >
ResultType FutureSharedStateDetail::Receiver< ResultType >::GetResult ( )
inline

Move the result away from the shared state, mark the future invalid.

◆ IsDone()

template<typename ResultType >
bool FutureSharedStateDetail::Receiver< ResultType >::IsDone ( ) const
inlinenoexcept

◆ RequestStop()

template<typename ResultType >
void FutureSharedStateDetail::Receiver< ResultType >::RequestStop ( )
inlinenoexcept

Request the executing thread to stop as fast as possible.

This is only a request the execution therad might ignore it.

See also
GetResult must not be called after a call to RequestStop.

◆ Wait()

template<typename ResultType >
void FutureSharedStateDetail::Receiver< ResultType >::Wait ( )
inline

Member Data Documentation

◆ m_ConditionVariable

template<typename ResultType >
std::condition_variable FutureSharedStateDetail::Receiver< ResultType >::m_ConditionVariable

◆ m_Done

template<typename ResultType >
std::atomic<bool> FutureSharedStateDetail::Receiver< ResultType >::m_Done {false}

◆ m_Mutex

template<typename ResultType >
std::mutex FutureSharedStateDetail::Receiver< ResultType >::m_Mutex

◆ m_Outcome

template<typename ResultType >
std::variant<std::exception_ptr, NonVoid<ResultType> > FutureSharedStateDetail::Receiver< ResultType >::m_Outcome

◆ m_StopRequest

template<typename ResultType >
std::atomic<bool> FutureSharedStateDetail::Receiver< ResultType >::m_StopRequest {false}

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