Lely core libraries 2.3.4
|
A future. More...
#include <future.hpp>
Public Types | |
using | result_type = util::Result< T, E > |
The type of the result stored in the shared state. | |
Public Member Functions | |
Future () noexcept=default | |
Constructs future without (a reference to) a shared state. | |
Future (const Future &other) noexcept | |
Constructs a future with a reference to the shared state of other. | |
Future (Future &&other) noexcept | |
Moves the shared state of other to *this . | |
Future & | operator= (const Future &other) noexcept |
Abandons the shared state of *this as if by ~Future(), then creates a reference to the shared state of other. | |
Future & | operator= (Future &&other) noexcept |
Abandons the shared state of *this as if by ~Future(), then moves the shared state of other to *this . | |
~Future () | |
Abandons the shared state. | |
operator bool () const noexcept | |
Checks whether *this contains (a reference to) a shared state. | |
bool | is_unique () const noexcept |
Checks whether *this contains a unique reference to its shared state. | |
bool | is_ready () const noexcept |
Checks whether the future is ready, i.e., its associated promise has been satisfied and a result has been stored in the shared state. | |
result_type & | get () |
Returns the result of a ready future. | |
const result_type & | get () const |
Returns the result of a ready future. | |
void | submit (ev_task &task) noexcept |
template<class F > | |
void | submit (ev_exec_t *exec, F &&f) |
bool | cancel (ev_task &task) noexcept |
::std::size_t | cancel_all () noexcept |
bool | abort (ev_task &task) noexcept |
::std::size_t | abort_all () noexcept |
template<class F > | |
AsyncTask< F, Future >::future_type | then (ev_exec_t *exec, F &&f) |
Attaches a continuation function to a future and returns a new future which becomes ready once the continuation completes. | |
|
defaultnoexcept |
Constructs future without (a reference to) a shared state.
|
inlinenoexcept |
Moves the shared state of other to *this
.
Definition at line 407 of file future.hpp.
Abandons the shared state.
If no references remain to the shared state, it is destroyed.
Definition at line 447 of file future.hpp.
Abandons the shared state of *this
as if by ~Future(), then creates a reference to the shared state of other.
*this
. Definition at line 418 of file future.hpp.
|
inlinenoexcept |
Abandons the shared state of *this
as if by ~Future(), then moves the shared state of other to *this
.
*this
; Definition at line 435 of file future.hpp.
Checks whether *this
contains a unique reference to its shared state.
Definition at line 462 of file future.hpp.
Checks whether the future is ready, i.e., its associated promise has been satisfied and a result has been stored in the shared state.
Definition at line 475 of file future.hpp.
|
inline |
Returns the result of a ready future.
lely::ev::future_not_ready | if operator bool() or is_ready() returns false. |
Definition at line 490 of file future.hpp.
|
inline |
Returns the result of a ready future.
lely::ev::future_not_ready | if operator bool() or is_ready() returns false. |
Definition at line 506 of file future.hpp.
Definition at line 513 of file future.hpp.
|
inline |
Definition at line 520 of file future.hpp.
Definition at line 526 of file future.hpp.
|
inlinenoexcept |
Definition at line 532 of file future.hpp.
Definition at line 538 of file future.hpp.
|
inlinenoexcept |
Definition at line 544 of file future.hpp.
|
inline |
Attaches a continuation function to a future and returns a new future which becomes ready once the continuation completes.
The continuation receives a single parameter: *this
. The result of the continuation (or any exception thrown during invocation) is stored in the future, unless the continuation returns a future. In that case, the result of that future (as obtained by get().value()
) is used instead. This is known as implicit unwrapping.
Definition at line 558 of file future.hpp.