Difference between revisions of "cpp/thread"
From cppreference.com
< cpp
(move dcl list items to templates) |
(formatting) |
||
Line 18: | Line 18: | ||
===Mutual exclusion=== | ===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. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
{{dcl list begin}} | {{dcl list begin}} | ||
{{dcl list header | mutex}} | {{dcl list header | mutex}} | ||
− | {{dcl list | + | {{dcl list class | cpp/thread/mutex | provides basic mutual exclusion facility | notes={{mark c++0x}}}} |
− | {{dcl list | + | {{dcl list class | cpp/thread/recursive_mutex | provides mutual exclusion facility which can be locked recursively by the same thread | notes={{mark c++0x}}}} |
− | {{dcl list fun | | + | {{dcl list class | cpp/thread/timed_mutex | provides mutual exclusion facility which implements locking with a timeout | notes={{mark c++0x}}}} |
+ | {{dcl list class | cpp/thread/recursive_timed_mutex | provides mutual exclusion facility which can be locked recursively<br> by the same thread and implements locking with a timeout | notes={{mark c++0x}}}} | ||
+ | {{dcl list h2 | Generic mutex management}} | ||
+ | {{dcl list tclass | cpp/thread/lock_guard | implements strictly scope-based mutex ownership wrapper | notes={{mark c++0x}}}} | ||
+ | {{dcl list tclass | cpp/thread/unique_lock | implements movable mutex ownership wrapper | notes={{mark c++0x}}}} | ||
+ | {{dcl list h2 | Generic locking algorithms}} | ||
+ | {{dcl list fun | cpp/thread/try_lock | locks specified mutexes/locks, returns {{cpp|false}} if at least one is unavailable | notes={{mark c++0x}}}} | ||
+ | {{dcl list fun | cpp/thread/lock | locks specified mutexes/locks, blocks if at least one is unavailable | notes={{mark c++0x}}}} | ||
{{dcl list end}} | {{dcl list end}} | ||
− | + | ||
+ | {{todo | reason=call_once, once_flag}} | ||
+ | |||
===Condition variables=== | ===Condition variables=== | ||
{{todo}} | {{todo}} | ||
− | ==Futures== | + | ===Futures=== |
{{todo}} | {{todo}} |
Revision as of 12:34, 16 July 2011
Contents |
Threads
Threads enable the program to execute across several processor cores.
Defined in header
<thread> | |
Functions managing 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.
Defined in header
<mutex> | |
provides basic mutual exclusion facility (class) | |
provides mutual exclusion facility which can be locked recursively by the same thread (class) | |
provides mutual exclusion facility which implements locking with a timeout (class) | |
provides mutual exclusion facility which can be locked recursively by the same thread and implements locking with a timeout (class) | |
Generic mutex management | |
implements strictly scope-based mutex ownership wrapper (class template) | |
implements movable mutex ownership wrapper (class template) | |
Generic locking algorithms | |
locks specified mutexes/locks, returns Template:cpp if at least one is unavailable (function) | |
locks specified mutexes/locks, blocks if at least one is unavailable (function) |
This section is incomplete Reason: call_once, once_flag |
Condition variables
This section is incomplete |
Futures
This section is incomplete |