|
CatapultServer
v0.5.0.1 (Elephant)
|
Shared state that is shared between a promise and a future. More...


Public Member Functions | |
| shared_state () | |
| Creates an incomplete shared state. More... | |
| bool | is_ready () const |
Returns true if this shared state has completed and get will not block. More... | |
| T | get () |
| Returns the result of this shared state and blocks until the result is available. More... | |
| void | set_value (T &&value) |
| Sets the result of this shared state to value. More... | |
| void | set_exception (std::exception_ptr pException) |
| Sets the result of this shared state to pException. More... | |
| void | set_continuation (const ContinuationFunc &continuation) |
| Configures continuation to run at the completion of this shared state. More... | |
Private Types | |
| enum | future_status { future_status::pending, future_status::completed_success, future_status::completed_error } |
| using | ContinuationFunc = consumer< const std::shared_ptr< shared_state< T > >> |
Private Member Functions | |
| void | assert_pending () const |
| void | signal (future_status status) |
| void | invokeContinuation () |
Private Member Functions inherited from catapult::utils::NonCopyable | |
| constexpr | NonCopyable ()=default |
| Default constructor. More... | |
| ~NonCopyable ()=default | |
| Default destructor. More... | |
| NonCopyable (const NonCopyable &)=delete | |
| Disabled copy constructor. More... | |
| NonCopyable & | operator= (const NonCopyable &)=delete |
| Disabled assignment operator. More... | |
Private Attributes | |
| std::atomic< future_status > | m_status |
| T | m_value |
| std::exception_ptr | m_pException |
| ContinuationFunc | m_continuation |
| std::condition_variable | m_condition |
| std::mutex | m_mutex |
Shared state that is shared between a promise and a future.
|
private |
|
strongprivate |
|
inline |
Creates an incomplete shared state.
|
inlineprivate |


|
inline |
Returns the result of this shared state and blocks until the result is available.
|
inlineprivate |

|
inline |
Returns true if this shared state has completed and get will not block.

|
inline |
Configures continuation to run at the completion of this shared state.

|
inline |
Sets the result of this shared state to pException.

|
inline |
Sets the result of this shared state to value.

|
inlineprivate |


|
private |
|
private |
|
private |
|
private |
|
private |
|
private |