Namespaces
Variants
Views
Actions

std::packaged_task

From cppreference.com
< cpp‎ | thread
Revision as of 08:39, 1 November 2011 by Cubbi (Talk | contribs)

Template:cpp/thread/packaged task/sidebar Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <future>
</td>

<td></td> <td></td> </tr> <tr class="t-dcl ">

<td >
template< class > class packaged_task; //not defined
</td>

<td > (1) </td> <td > Template:mark c++11 feature </td> </tr> <tr class="t-dcl ">

<td >
template< class Function, class Args... >
class packaged_task<Function(Args...)>;
</td>

<td > (2) </td> <td > Template:mark c++11 feature </td> </tr> Template:ddcl list end

The class template std::packaged_task packages a function to store its return value that is later acquired asynchronously via a Template:cpp object, that the std::packaged_task can supply.


Contents

Member functions

constructs the task object
(public member function)
destructs the task object
(public member function)
moves the task object
(public member function)
checks if the task object has a valid function
(public member function)
swaps two task objects
(public member function)
Getting the result
returns a future associated with the promised result
(public member function)
Execution
executes the function
(public member function)
executes the function ensuring that the result is ready
only once the current thread exits
(public member function)
resets the state abandoning any stored results of previous executions
(public member function)

Non-member functions

Helper classes

Template:cpp/thread/packaged task/dcl list uses allocator