Portable concurrency
0.11.0
|
The class template shared_future provides a mechanism to access the result of asynchronous operations. More...
Public Member Functions | |
template<typename F > | |
void | notify (F &¬ification) |
template<typename E , typename F > | |
void | notify (E &&exec, F &¬ification) |
shared_future | detach () |
The class template shared_future provides a mechanism to access the result of asynchronous operations.
shared_future detach | ( | ) |
Prevents cancelation of the operations of this shared_future value calculation on its destruction.
void notify | ( | E && | exec, |
F && | notification | ||
) |
Adds notification function to be called when this future object becomes ready.
Notification function must meet MoveConstructable
, MoveAssignable
and Callable
(with signature void()
) standard library requirements.
Both exec
and notification
objects are decay copied on the caller thread. Once this future object becomes ready post(exec, std::move(notification))
is executed on unspecified thread. Implementation provide strict guaranty that notification
is scheduled for execution at most once. If this->is_ready() == true
then notification
is scheduled for execution immediatelly.
void notify | ( | F && | notification | ) |
Adds notification function to be called when this future object becomes ready.
Equivalent to this->notify(inplace_executor, notification)
.
notification
execution is unspecified.