shared_future Class

Describes an asynchronous return object. In contrast with a future object, an asynchronous provider can be associated with any number of shared_future objects.

template<class Ty>
class shared_future;

Remarks

Do not call any methods other than valid, operator=, and the destructor on a shared_future object that's empty.

shared_future objects are not synchronized. Calling methods on the same object from multiple threads introduces a data race that has unpredictable results.

Members

Public Constructors

Name

Description

shared_future::shared_future Constructor

Constructs a shared_future object.

Public Methods

Name

Description

shared_future::get Method

Retrieves the result that's stored in the associated asynchronous state.

shared_future::valid Method

Specifies whether the object is not empty.

shared_future::wait Method

Blocks the current thread until the associated asynchronous state is ready.

shared_future::wait_for Method

Blocks until the associated asynchronous state is ready or until the specified time has elapsed.

shared_future::wait_until Method

Blocks until the associated asynchronous state is ready or until a specified point in time.

Public Operators

Name

Description

shared_future::operator= Operator

Assigns a new associated asynchronous state.

Requirements

Header: future

Namespace: std

See Also

Reference

<future>

Other Resources

Header Files