table of contents
std::packaged_task::operator()(3) | C++ Standard Libary | std::packaged_task::operator()(3) |
NAME¶
std::packaged_task::operator() - std::packaged_task::operator()
Synopsis¶
void operator()( ArgTypes... args ); (since C++11)
Calls the stored task with args as the arguments. The return value of the
task or
any exceptions thrown are stored in the shared state. The shared state is
made ready
and any threads waiting for this are unblocked.
Parameters¶
args - the parameters to pass on invocation of the stored task
Return value¶
(none)
Exceptions¶
std::future_error on the following error conditions:
* The stored task has already been invoked. The error category is set to
promise_already_satisfied.
* *this has no shared state. The error category is set to no_state.
Example¶
This section is incomplete
Reason: no example
Defect reports
The following behavior-changing defect reports were applied retroactively to
previously published C++ standards.
DR Applied to Behavior as published Correct behavior
A successful call to operator()
synchronizes with a call to any No additional synchronization
LWG 2142 C++11 member function of a std::future guarantees
or std::shared_future that other than what's already
share their shared state with provided by shared state.
*this.
See also¶
executes the function ensuring that the result is ready
make_ready_at_thread_exit only once the current thread exits
(public member function)
2022.07.31 | http://cppreference.com |