Thread support library
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
C++ includes built-in support for threads, mutual exclusion, condition variables, and futures.
Indice |
[modifica] Threads
Threads enable programs to execute across several processor cores.
Definizione nell'header
<thread> | |
(C++11) |
gestisce un thread separato 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 (funzione) |
(C++11) |
restituisce l'id del thread corrente 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. (funzione) |
(C++11) |
blocca l'esecuzione del thread corrente per un periodo di tempo specificato 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. (funzione) |
(C++11) |
stops the execution of the current thread until a specified time point (funzione) |
[modifica] Mutua esclusione
Mutual exclusion algorithms prevent multiple threads from simultaneously accessing shared resources. This prevents data races and provides support for synchronization between threads.
Definizione nell'header
<mutex> | |
(C++11) |
fornisce di base impianto di mutua esclusione 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) |
fornisce la funzione di mutua esclusione che implementa di bloccaggio con un timeout 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) |
fornisce la funzione mutua esclusione, che può essere bloccato in modo ricorsivo dal filo stesso 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) |
fornisce la funzione di mutua esclusione che possono essere bloccati recursively dallo stesso thread e attrezzi di bloccaggio con un timeout 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 un ambito rigorosamente a base di wrapper di proprietà 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. (classe template) |
(C++11) |
implementa mobile involucro proprietà 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. (classe template) |
tipo di tag utilizzato per specificare strategia di blocco 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) | |
costanti tag utilizzato per specificare strategia di blocco 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. (costante) | |
Generic locking algorithms | |
(C++11) |
tentativi di ottenere la proprietà del mutex con ripetute chiamate a 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. (funzione di modello) |
(C++11) |
blocca specificati mutex, blocchi se non sono disponibili 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. (funzione di modello) |
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) |
oggetto di supporto per garantire che call_once richiama la funzione una sola volta 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) |
richiama una funzione solo una volta, anche se chiamato da più thread 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. (funzione di modello) |
[modifica] Condizioni variabili
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.
Definizione nell'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 (funzione) |
(C++11) |
lists the possible results of timed waits on condition variables (enum) |
[modifica] 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 or std::shared_future that reference that shared state.
Definizione nell'header
<future> | |
(C++11) |
memorizza un valore per il recupero asincrono 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. (classe template) |
(C++11) |
pacchetti di una funzione per memorizzare il suo valore di ritorno per il recupero asincrono 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. (classe template) |
(C++11) |
attende per un valore che è impostato in modo asincrono 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. (classe template) |
(C++11) |
attende un valore (eventualmente riferimento altri futuri) che è impostato in modo asincrono 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. (classe template) |
(C++11) |
esegue una funzione in modo asincrono (potenzialmente in un nuovo thread) e restituisce un std::future che conterrà il risultato 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. (funzione di modello) |
(C++11) |
specifica la politica di lancio per 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) |
specifica i risultati temporizzato attese eseguiti su 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) |
segnala un errore relativo ai futures o promesse 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 la futura categoria di errore 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. (funzione) |
(C++11) |
individua i codici di errore in 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) |