std::this_thread::sleep_for
Da cppreference.com.
![]() |
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. |
Elemento definito nell'header <thread>
|
||
template< class Rep, class Period > void sleep_for( std::chrono::duration<Rep,Period> sleep_duration ); |
(dal C++11) | |
Blocca l'esecuzione del thread corrente di almeno la
sleep_duration
specificato. Original:
Blocks the execution of the current thread for at least the specified
sleep_duration
. The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Le chiamate a
sleep_for
può bloccare per più di sleep_duration
se il sistema operativo sottostante non supporta la granularità specificato da sleep_duration
.Original:
Calls to
sleep_for
may block for longer than sleep_duration
if the underlying operating system does not support the granularity specified by sleep_duration
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Indice |
[modifica] Parametri
sleep_duration | - | durata di dormire
Original: time duration to sleep The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[modifica] Valore di ritorno
(Nessuno)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[modifica] Eccezioni
[modifica] Esempio
#include <iostream> #include <chrono> #include <thread> int main() { std::cout << "Hello waiter" << std::endl; std::chrono::milliseconds dura( 2000 ); std::this_thread::sleep_for( dura ); std::cout << "Waited 2000 ms\n"; }
Output:
Hello waiter Waited 2000 ms
[modifica] Vedi anche
(C++11) |
stops the execution of the current thread until a specified time point (funzione) |