Difference between revisions of "cpp/thread"
m (templated the error stuff) |
m (+one last top-level future item) |
||
Line 65: | Line 65: | ||
{{dcl list template | cpp/thread/dcl list async}} | {{dcl list template | cpp/thread/dcl list async}} | ||
{{dcl list template | cpp/thread/dcl list launch}} | {{dcl list template | cpp/thread/dcl list launch}} | ||
+ | {{dcl list template | cpp/thread/dcl list future_status}} | ||
{{dcl list template | cpp/thread/dcl list future_error}} | {{dcl list template | cpp/thread/dcl list future_error}} | ||
{{dcl list template | cpp/thread/dcl list future_category}} | {{dcl list template | cpp/thread/dcl list future_category}} | ||
{{dcl list template | cpp/thread/dcl list future_errc}} | {{dcl list template | cpp/thread/dcl list future_errc}} | ||
{{dcl list end}} | {{dcl list end}} |
Revision as of 06:52, 6 June 2012
Contents |
Threads
Threads enable the program to execute across several processor cores.
Defined in header
<thread> | |
Functions managing the current thread | |
Defined in namespace
this_thread |
Mutual exclusion
Mutual exclusion algorithms restrict access to a shared resource so that only one thread can access it at a time. This allows to avoid data races and to implement synchronization between threads.
Condition variables
A condition variable is a synchronization primitive which implements a list of threads that are waiting until another thread notifies one or all of the waiting threads that they may proceed, until a timeout expires, or until a spurious wakeup occurs. A condition variable is always associated with a mutex.
(C++11) |
provides a condition variable assocaited with std::unique_lock (class) |
(C++11) |
provides a condition variable associated with any lock type (class) |
(C++11) |
schedules a call to notify_all to be invoked when this thread exits (function) |
(C++11) |
lists the possible results of timed waits on condition variables (enum) |
Futures
The standard library provides facilities to obtain values that are returned and to catch exceptions that are thrown by asynchronous tasks, that is, by the functions launched on 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 or std::shared_future that reference that shared state.