Thread support library
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
C++ includes built-in support for threads, mutual exclusion, condition variables, and futures.
Índice |
[editar] Threads
Threads enable programs to execute across several processor cores.
Defined in header
<thread> | |
(C++11) |
gerencia um segmento separado Original: manages a separate thread The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe) |
Functions managing the current thread | |
Defined in namespace
this_thread | |
(C++11) |
suggests that the implementation reschedule execution of threads (função) |
(C++11) |
retorna o ID de segmento do segmento atual Original: returns the thread id of the current thread The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) |
(C++11) |
interrompe a execução da thread atual por um período de tempo especificado Original: stops the execution of the current thread for a specified time duration The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) |
(C++11) |
stops the execution of the current thread until a specified time point (função) |
[editar] Exclusão mútua
Mutual exclusion algorithms prevent multiple threads from simultaneously accessing shared resources. This prevents data races and provides support for synchronization between threads.
Defined in header
<mutex> | |
(C++11) |
fornece a facilidade básica exclusão mútua Original: provides basic mutual exclusion facility The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe) |
(C++11) |
fornece a facilidade de exclusão mútua que implementa bloqueio com um tempo limite Original: provides mutual exclusion facility which implements locking with a timeout The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe) |
(C++11) |
fornece a facilidade de exclusão mútua, que pode ser bloqueada repetidamente pelo mesmo segmento Original: provides mutual exclusion facility which can be locked recursively by the same thread The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe) |
(C++11) |
fornece a facilidade de exclusão mútua, que pode ser bloqueado recursively pelo mesmo segmento e implementos com um tempo limite de bloqueio Original: provides mutual exclusion facility which can be locked recursively by the same thread and implements locking with a timeout The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe) |
Generic mutex management | |
(C++11) |
implementa um invólucro propriedade estritamente baseada em escopo mutex Original: implements a strictly scope-based mutex ownership wrapper The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (modelo de classe) |
(C++11) |
implementa móvel invólucro propriedade mutex Original: implements movable mutex ownership wrapper The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (modelo de classe) |
tipo de etiqueta usada para especificar estratégia de bloqueio Original: tag type used to specify locking strategy The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe) | |
constantes tag usada para especificar estratégia de bloqueio Original: tag constants used to specify locking strategy The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (constante) | |
Generic locking algorithms | |
(C++11) |
tentativas de obter a propriedade de semáforos através de chamadas repetidas para try_lock Original: attempts to obtain ownership of mutexes via repeated calls to try_lock The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (modelo de função) |
(C++11) |
bloqueia especificados semáforos, blocos se algum não estão disponíveis Original: locks specified mutexes, blocks if any are unavailable The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (modelo de função) |
Original: Call once The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
(C++11) |
objeto auxiliar a assegurar que call_once invoca a função apenas uma vez Original: helper object to ensure that call_once invokes the function only once The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe) |
(C++11) |
chama uma função apenas uma vez, mesmo se chamado de vários segmentos Original: invokes a function only once even if called from multiple threads The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (modelo de função) |
[editar] Variáveis de condição
A condition variable is a synchronization primitive that allows multiple threads to communicate with eachother. It allows some number of threads to wait (possibly with a timeout) for notification from another thread that they may proceed. A condition variable is always associated with a mutex.
Defined in header
<condition_variable> | |
(C++11) |
provides a condition variable associated with a std::unique_lock (classe) |
(C++11) |
provides a condition variable associated with any lock type (classe) |
(C++11) |
schedules a call to notify_all to be invoked when this thread is completely finished (função) |
(C++11) |
lists the possible results of timed waits on condition variables (enum) |
[editar] Futuros
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 or std::shared_future that reference that shared state.
Defined in header
<future> | |
(C++11) |
armazena um valor para a recuperação assíncrona Original: stores a value for asynchronous retrieval The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (modelo de classe) |
(C++11) |
pacotes de uma função para armazenar o valor de retorno para a recuperação assíncrona Original: packages a function to store its return value for asynchronous retrieval The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (modelo de classe) |
(C++11) |
espera por um valor que é definido de forma assíncrona Original: waits for a value that is set asynchronously The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (modelo de classe) |
(C++11) |
espera por um valor (possivelmente relacionado por outros futuros) que é definido de forma assíncrona Original: waits for a value (possibly referenced by other futures) that is set asynchronously The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (modelo de classe) |
(C++11) |
executa uma função de forma assíncrona (potencialmente em um novo segmento) e retorna uma std::future que vai segurar o resultado Original: runs a function asynchronously (potentially in a new thread) and returns a std::future that will hold the result The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (modelo de função) |
(C++11) |
especifica a política de lançamento para std::async Original: specifies the launch policy for std::async The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (enum) |
(C++11) |
especifica os resultados de temporização esperas realizada em std::future e std::shared_future Original: specifies the results of timed waits performed on std::future and std::shared_future The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (enum) |
Future errors | |
(C++11) |
relata um erro relacionado a futuros ou promessas Original: reports an error related to futures or promises The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe) |
(C++11) |
identifica a categoria de erro futuro Original: identifies the future error category The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) |
(C++11) |
identifica os códigos de erro do futuro Original: identifies the future error codes The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (enum) |