std::mutex::unlock
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. |
void unlock(); | (dal C++11) | |
Sblocca il mutex.
Original:
Unlocks the mutex.
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
(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]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
This section is incomplete |
[modifica]Esempio
Questo esempio mostra blocco, try_lock e sbloccare in azione
Original:
This example shows lock, try_lock and unlock in action
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.
#include <iostream>#include <mutex> int main(){std::mutex test;if(test.try_lock()==true)std::cout<<"lock acquired"<<std::endl;elsestd::cout<<"lock not acquired"<<std::endl; test.unlock();//now unlock the mutex test.lock();//to lock it againif(test.try_lock())//true can be left outstd::cout<<"lock acquired"<<std::endl;elsestd::cout<<"lock not acquired"<<std::endl; test.lock();//and now the finale (a block)}
Output:
lock acquired lock not acquired (program hangs)
[modifica]Vedi anche
blocca i blocchi mutex, se il mutex non è disponibile Original: locks the mutex, blocks if the mutex is not available The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
prova a bloccare il mutex, restituisce se il mutex non è disponibile Original: tries to lock the mutex, returns if the mutex is not available The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) |