Freigeben über


packaged_task Class

Describes an asynchronous provider that is a call wrapper whose call signature is Ty(ArgTypes...). Its associated asynchronous state holds a copy of its callable object in addition to the potential result.

template<class>
class packaged_task;

Members

Public Constructors

Name

Description

packaged_task::packaged_task Constructor

Constructs a packaged_task object.

packaged_task::~packaged_task Destructor

Destroys a packaged_task object.

Public Methods

Name

Description

packaged_task::get_future Method

Returns a future object that has the same associated asynchronous state.

packaged_task::make_ready_at_thread_exit Method

Calls the callable object that's stored in the associated asynchronous state and atomically stores the returned value.

packaged_task::reset Method

Replaces the associated asynchronous state.

packaged_task::swap Method

Exchanges the associated asynchronous state with that of a specified object.

packaged_task::valid Method

Specifies whether the object has an associated asynchronous state.

Public Operators

Name

Description

packaged_task::operator= Operator

Transfers an associated asynchronous state from a specified object.

packaged_task::operator() Operator

Calls the callable object that's stored in the associated asynchronous state, atomically stores the returned value, and sets the state to ready.

packaged_task::operator bool Operator

Specifies whether the object has an associated asynchronous state.

Requirements

Header: future

Namespace: std

See Also

Reference

<future>

Other Resources

C++ Standard Library Header Files