Knihovna podpory vlken
C++ zahrnuje vestavnou podporu pro vlkna, vzjemn vylouen, podmnn promnn a futury.
Vlkna
Vlkne umouj programm soubn bh na vce procesorovch jader.
Definovno v hlavikovm souboru
<thread> | |
(C++11) |
manages a separate thread (class) |
Funkce pro sprvu aktivnho vlkna | |
Definovno v jmennm prostoru
this_thread | |
(C++11) |
suggests that the implementation reschedule execution of threads (function) |
(C++11) |
vrac vlknov id souasnho vlkna (function) |
(C++11) |
na zadanou dobu pozastav provdn souasnho vlkna (function) |
(C++11) |
pozastav provdn souasnho vlkna a do zadanho okamiku (function) |
Vzjemn vylouen
Algoritmy vzjemnho vylouen (anglicky mutual exclusion algorithms) zabrauj souasnmu pstupu vcero vlken ke stejnm sdlenm zdrojm. Tm zabrauj vzniku datovho soubhu a nabz podporu pro synchronizaci vlken.
ablona:cpp/thread/dsc shared timed mutexDefinovno v hlavikovm souboru
<mutex> | |
(C++11) |
provides basic mutual exclusion facility (class) |
(C++11) |
provides mutual exclusion facility which implements locking with a timeout (class) |
(C++11) |
provides mutual exclusion facility which can be locked recursively by the same thread (class) |
(C++11) |
provides mutual exclusion facility which can be locked recursively by the same thread and implements locking with a timeout (class) |
Definovno v hlavikovm souboru
<shared_mutex> | |
Generic mutex management | |
Definovno v hlavikovm souboru
<mutex> | |
(C++11) |
implements a strictly scope-based mutex ownership wrapper (class template) |
(C++11) |
implements movable mutex ownership wrapper (class template) |
(C++14) |
implements movable shared mutex ownership wrapper (class template) |
(C++11)(C++11)(C++11) |
tag type used to specify locking strategy (class) |
(C++11)(C++11)(C++11) |
tag constants used to specify locking strategy (constant) |
Generic locking algorithms | |
(C++11) |
attempts to obtain ownership of mutexes via repeated calls to try_lock (ablona funkce) |
(C++11) |
locks specified mutexes, blocks if any are unavailable (ablona funkce) |
Call once | |
(C++11) |
helper object to ensure that call_once invokes the function only once (class) |
(C++11) |
invokes a function only once even if called from multiple threads (ablona funkce) |
Podmnn promnn
Podmnn promnn pat mezi synchronizan primitiva, kter umouj komunikace mezi rznmi vlkny. Umouje vlknm ekat (ppadn s lhtou) na upozornn od jinho vlkna, e mohou pokraovat. Podmnn promnn je vdy spojen s konkrtnm vzjemnm vylouenm (mutexem).
Definovno v hlavikovm souboru
<condition_variable> | |
(C++11) |
provides a condition variable associated with a 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 is completely finished (function) |
(C++11) |
lists the possible results of timed waits on condition variables (enum) |
Futury
Standardn knihovna poskytuje nstroje, jak zskat nvratov hodnoty a chytat vjimky asynchronnch loh (tedy funkc provdnch v oddlench vlknech). Tyto hodnoty jsou pedvny v sdlenm stavu, do kterho me asynchronn loha zapsat svou nvratovou hodnotu nebo uloit vjimku, a kter mohou zkoumat, na kter mohou ekat a s kterm mohou i jinak pracovat jin vlkna, kter maj instanci std::future nebo std::shared_future, kter k sdlenmu stavu odkazuje.
Definovno v hlavikovm souboru
<future> | |
(C++11) |
stores a value for asynchronous retrieval (class template) |
(C++11) |
packages a function to store its return value for asynchronous retrieval (class template) |
(C++11) |
waits for a value that is set asynchronously (class template) |
(C++11) |
waits for a value (possibly referenced by other futures) that is set asynchronously (class template) |
(C++11) |
runs a function asynchronously (potentially in a new thread) and returns a std::future that will hold the result (ablona funkce) |
(C++11) |
specifies the launch policy for std::async (enum) |
(C++11) |
specifies the results of timed waits performed on std::future and std::shared_future (enum) |
Future errors | |
(C++11) |
reports an error related to futures or promises (class) |
(C++11) |
identifies the future error category (function) |
(C++11) |
identifies the future error codes (enum) |
Vizte t
C documentation for Knihovna podpory vlken
|