Pyrogenesis
trunk
|
The shared state between futures and packaged state. More...
#include <Future.h>
Public Member Functions | |
SharedState (std::function< ResultType()> &&func) | |
m_Func (std::move(func)) | |
~SharedState () | |
SharedState (const SharedState &)=delete | |
SharedState (SharedState &&)=delete | |
bool | IsDoneOrCanceled () const |
void | Wait () |
bool | Cancel () |
If the task is pending, cancel it: the status becomes CANCELED and if the task was completed, the result is destroyed. More... | |
template<typename _ResultType = ResultType> | |
std::enable_if_t<!std::is_same_v< _ResultType, void >, ResultType > | GetResult () |
Move the result away from the shared state, mark the future invalid. More... | |
Public Attributes | |
std::atomic< Status > | m_Status = Status::PENDING |
std::mutex | m_Mutex |
std::condition_variable | m_ConditionVariable |
std::function< ResultType()> | m_Func |
Static Private Attributes | |
static constexpr bool | VoidResult = std::is_same_v<ResultType, void> |
The shared state between futures and packaged state.
Holds all relevant data.
|
inline |
|
inline |
|
delete |
|
delete |
|
inline |
If the task is pending, cancel it: the status becomes CANCELED and if the task was completed, the result is destroyed.
|
inline |
Move the result away from the shared state, mark the future invalid.
|
inline |
|
inline |
|
inline |
std::condition_variable FutureSharedStateDetail::SharedState< ResultType >::m_ConditionVariable |
std::function<ResultType()> FutureSharedStateDetail::SharedState< ResultType >::m_Func |
std::mutex FutureSharedStateDetail::SharedState< ResultType >::m_Mutex |
std::atomic<Status> FutureSharedStateDetail::SharedState< ResultType >::m_Status = Status::PENDING |
|
staticprivate |