en.cppreference.com/mwiki/index.php?title=Template:cpp/thread/dsc_binary_semaphore&action=edit)  
  
###  Latches and Barriers

Latches and barriers are thread coordination mechanisms that allow any number
of threads to block until an expected number of threads arrive. A latch cannot
be reused, while a barrier can be used repeatedly.

Defined in header ` [ <latch> ](/w/cpp/header/latch "cpp/header/latch") `  
---  
[ latch  ](/w/cpp/thread/latch "cpp/thread/latch") (C++20)  |  single-use thread barrier   
(class)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/thread/dsc_latch&action=edit)  
Defined in header ` [ <barrier> ](/w/cpp/header/barrier "cpp/header/barrier")
`  
[ barrier  ](/w/cpp/thread/barrier "cpp/thread/barrier") (C++20)  |  reusable thread barrier   
(class template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/thread/dsc_barrier&action=edit)  
(since C++20)  
  
###  [ [ edit ](/mwiki/index.php?title=cpp/thread&action=edit&section=9 "Edit
section: Futures") ]  Futures

The standard library provides facilities to obtain values that are returned
and to catch exceptions that are thrown by asynchronous tasks (i.e. functions
launched in separate threads). These values are communicated in a _shared
state_ , in which the asynchronous task may write its return value or store an
exception, and which may be examined, waited for, and otherwise manipulated by
other threads that hold instances of  [ std::future ](/w/cpp/thread/future
"cpp/thread/future") or  [ std::shared_future ](/w/cpp/thread/shared_future
"cpp/thread/shared future") that reference that shared state.

Defined in header ` [ <future> ](/w/cpp/header/future "cpp/header/future") `  
---  
[ promise  ](/w/cpp/thread/promise "cpp/thread/promise") (C++11)  |  stores a value for asynchronous retrieval   
(class template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/thread/dsc_promise&action=edit)  
[ packaged_task  ](/w/cpp/thread/packaged_task "cpp/thread/packaged task") (C++11)  |  packages a function to store its return value for asynchronous retrieval   
(class template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/thread/dsc_packaged_task&action=edit)  
[ future  ](/w/cpp/thread/future "cpp/thread/future") (C++11)  |  waits for a value that is set asynchronously   
(class template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/thread/dsc_future&action=edit)  
[ shared_future  ](/w/cpp/thread/shared_future "cpp/thread/shared future") (C++11)  |  waits for a value (possibly referenced by other futures) that is set asynchronously   
(class template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/thread/dsc_shared_future&action=edit)  
[ async  ](/w/cpp/thread/async "cpp/thread/async") (C++11)  |  runs a function asynchronously (potentially in a new thread) and returns a  [ std::future ](/w/cpp/thread/future "cpp/thread/future") that will hold the result   
(function template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/thread/dsc_async&action=edit)  
[ launch  ](/w/cpp/thread/launch "cpp/thread/launch") (C++11)  |  specifies the launch policy for  [ std::async ](/w/cpp/thread/async "cpp/thread/async")   
(enum)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/thread/dsc_launch&action=edit)  
[ future_status  ](/w/cpp/thread/future_status "cpp/thread/future status") (C++11)  |  specifies the results of timed waits performed on  [ std::future ](/w/cpp/thread/future "cpp/thread/future") and  [ std::shared_future ](/w/cpp/thread/shared_future "cpp/thread/shared future")   
(enum)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/thread/dsc_future_status&action=edit)  
  
#####  Future errors  
  
[ future_error  ](/w/cpp/thread/future_error "cpp/thread/future error") (C++11)  |  reports an error related to future