CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
28 namespace catapult {
namespace thread {
namespace detail {
56 std::unique_lock<std::mutex> lock(
m_mutex);
69 std::lock_guard<std::mutex> lock(
m_mutex);
77 std::lock_guard<std::mutex> lock(
m_mutex);
85 std::lock_guard<std::mutex> lock(
m_mutex);
87 throw std::logic_error(
"continuation already set");
97 throw std::future_error(std::future_errc::promise_already_satisfied);
110 auto pStateCopy = std::make_shared<shared_state<T>>();
111 pStateCopy->m_status =
m_status.load();
112 pStateCopy->m_value = std::move(
m_value);
Shared state that is shared between a promise and a future.
Definition: FutureSharedState.h:32
void set_continuation(const ContinuationFunc &continuation)
Configures continuation to run at the completion of this shared state.
Definition: FutureSharedState.h:84
std::exception_ptr m_pException
Definition: FutureSharedState.h:120
shared_state()
Creates an incomplete shared state.
Definition: FutureSharedState.h:44
future_status
Definition: FutureSharedState.h:36
std::mutex m_mutex
Definition: FutureSharedState.h:124
std::condition_variable m_condition
Definition: FutureSharedState.h:123
consumer< const std::shared_ptr< shared_state< T > >> ContinuationFunc
Definition: FutureSharedState.h:34
void set_exception(std::exception_ptr pException)
Sets the result of this shared state to pException.
Definition: FutureSharedState.h:76
bool is_ready() const
Returns true if this shared state has completed and get will not block.
Definition: FutureSharedState.h:49
void signal(future_status status)
Definition: FutureSharedState.h:100
void invokeContinuation()
Definition: FutureSharedState.h:109
std::atomic< future_status > m_status
Definition: FutureSharedState.h:118
T get()
Returns the result of this shared state and blocks until the result is available.
Definition: FutureSharedState.h:54
void set_value(T &&value)
Sets the result of this shared state to value.
Definition: FutureSharedState.h:68
Definition: AddressExtractionExtension.cpp:28
ContinuationFunc m_continuation
Definition: FutureSharedState.h:121
A class that can neither be copied nor moved.
Definition: NonCopyable.h:26
std::function< void(TArgs...)> consumer
A consumer function.
Definition: functions.h:35
T m_value
Definition: FutureSharedState.h:119
void assert_pending() const
Definition: FutureSharedState.h:95