39 lines
4.2 KiB
Markdown
39 lines
4.2 KiB
Markdown
[future.syn]
|
||
|
||
# 32 Concurrency support library [[thread]](./#thread)
|
||
|
||
## 32.10 Futures [[futures]](futures#future.syn)
|
||
|
||
### 32.10.2 Header <future> synopsis [future.syn]
|
||
|
||
[ð](#header:%3cfuture%3e)
|
||
|
||
namespace std {enum class [future_errc](#lib:future_errc "32.10.2 Header <future> synopsis [future.syn]") {[broken_promise](#lib:future_errc,broken_promise "32.10.2 Header <future> synopsis [future.syn]") = *implementation-defined*, [future_already_retrieved](#lib:future_errc,future_already_retrieved "32.10.2 Header <future> synopsis [future.syn]") = *implementation-defined*, [promise_already_satisfied](#lib:future_errc,promise_already_satisfied "32.10.2 Header <future> synopsis [future.syn]") = *implementation-defined*, [no_state](#lib:future_errc,no_state "32.10.2 Header <future> synopsis [future.syn]") = *implementation-defined*}; enum class [launch](#lib:launch "32.10.2 Header <future> synopsis [future.syn]") : *unspecified* {[async](#lib:launch,async "32.10.2 Header <future> synopsis [future.syn]") = *unspecified*, [deferred](#lib:launch,deferred "32.10.2 Header <future> synopsis [future.syn]") = *unspecified*, *implementation-defined*}; enum class [future_status](#lib:future_status "32.10.2 Header <future> synopsis [future.syn]") {[ready](#lib:future_status,ready "32.10.2 Header <future> synopsis [future.syn]"), [timeout](#lib:future_status,timeout "32.10.2 Header <future> synopsis [future.syn]"), [deferred](#lib:future_status,deferred "32.10.2 Header <future> synopsis [future.syn]")}; // [[futures.errors]](futures.errors "32.10.3 Error handling"), error handlingtemplate<> struct is_error_code_enum<future_errc> : public true_type { };
|
||
error_code make_error_code(future_errc e) noexcept;
|
||
error_condition make_error_condition(future_errc e) noexcept; const error_category& future_category() noexcept; // [[futures.future.error]](futures.future.error "32.10.4 Class future_error"), class future_errorclass future_error; // [[futures.promise]](futures.promise "32.10.6 Class template promise"), class template promisetemplate<class R> class promise; template<class R> class promise<R&>; template<> class promise<void>; template<class R>void swap(promise<R>& x, promise<R>& y) noexcept; // [[futures.unique.future]](futures.unique.future "32.10.7 Class template future"), class template futuretemplate<class R> class future; template<class R> class future<R&>; template<> class future<void>; // [[futures.shared.future]](futures.shared.future "32.10.8 Class template shared_future"), class template shared_futuretemplate<class R> class shared_future; template<class R> class shared_future<R&>; template<> class shared_future<void>; // [[futures.task]](futures.task "32.10.10 Class template packaged_task"), class template packaged_tasktemplate<class> class packaged_task; // *not defined*template<class R, class... ArgTypes>class packaged_task<R(ArgTypes...)>; template<class R, class... ArgTypes>void swap(packaged_task<R(ArgTypes...)>&, packaged_task<R(ArgTypes...)>&) noexcept; // [[futures.async]](futures.async "32.10.9 Function template async"), function template asynctemplate<class F, class... Args> future<invoke_result_t<decay_t<F>, decay_t<Args>...>> async(F&& f, Args&&... args); template<class F, class... Args> future<invoke_result_t<decay_t<F>, decay_t<Args>...>> async(launch policy, F&& f, Args&&... args);}
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L11204)
|
||
|
||
The enum type launch is a bitmask type ([[bitmask.types]](bitmask.types "16.3.3.3.3 Bitmask types")) with
|
||
elements launch::async and launch::deferred[.](#1.sentence-1)
|
||
|
||
[*Note [1](#note-1)*:
|
||
|
||
Implementations can provide bitmasks to specify restrictions on task
|
||
interaction by functions launched by async() applicable to a
|
||
corresponding subset of available launch policies[.](#1.sentence-2)
|
||
|
||
Implementations can extend
|
||
the behavior of the first overload of async() by adding their extensions
|
||
to the launch policy under the âas ifâ rule[.](#1.sentence-3)
|
||
|
||
â *end note*]
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L11215)
|
||
|
||
The enum values of future_errc are distinct and not zero[.](#2.sentence-1)
|