std::timed_mutex::unlock
De cppreference.com
|
|
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. |
<metanoindex/>
<tbody> </tbody> void unlock(); |
(depuis C++11) | |
Déverrouille le 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.
Paramètres
(Aucun)
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.
Retourne la valeur
(Aucun)
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.
Exceptions
| This section is incomplete |
Exemple
Cet exemple montre serrure, try_lock et déverrouiller en action
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;
else
std::cout << "lock not acquired" << std::endl;
test.unlock(); //now unlock the mutex
test.lock(); //to lock it again
if (test.try_lock()) //true can be left out
std::cout << "lock acquired" << std::endl;
else
std::cout << "lock not acquired" << std::endl;
test.lock(); //and now the finale (a block)
}
Résultat :
lock acquired
lock not acquired
(program hangs)
Voir aussi
| verrouille le mutex, bloque si le mutex n'est pas disponible (fonction membre publique) | |
essaie de verrouiller le mutex, retourne si le mutex n'est pas disponible 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. (fonction membre publique) | |
essaie de verrouiller le mutex, les retours si le mutex a been unavailable pour la durée d'attente spécifié Original: tries to lock the mutex, returns if the mutex has been unavailable for the specified timeout duration The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
essaie de verrouiller le mutex, si le mutex retourne a been unavailable jusqu'à ce point dans le temps spécifié a été atteint Original: tries to lock the mutex, returns if the mutex has been unavailable until specified time point has been reached The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |