std::unique_lock::try_lock_for
Da cppreference.com.
< cpp | thread | unique lock
![]() | 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. |
template<class Rep, class Period > bool try_lock_for(conststd::chrono::duration<Rep,Period>& timeout_duration ); | (dal C++11) | |
Tenta di bloccare il mutex associato. Blocchi fino
timeout_duration
specificato è trascorso o il blocco viene acquisito, quello che viene prima. Il successo di acquisizione blocco true ritorni, altrimenti restituisce false. Può bloccare per più di timeout_duration
.Original:
Tries to lock the associated mutex. Blocks until specified
timeout_duration
has elapsed or the lock is acquired, whichever comes first. On successful lock acquisition returns true, otherwise returns false. May block for longer than timeout_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.
Chiama efficacemente mutex()->try_lock_for(timeout_duration)
Original:
Effectively calls mutex()->try_lock_for(timeout_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.
std::system_error viene generata se non c'è mutex associato o se il mutex è già bloccato.
Original:
std::system_error is thrown if there is no associated mutex or if the mutex is already locked.
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
timeout_duration | - | durata massima di bloccare per Original: maximum duration to block for 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
true se la proprietà del mutex è stato acquisito con successo, altrimenti false.
Original:
true if the ownership of the mutex has been acquired successfully, false otherwise.
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
- Eventuali eccezioni generate dal mutex()->try_lock_for(timeout_duration)Original:Any exceptions thrown by mutex()->try_lock_for(timeout_duration)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- Se non vi è associato mutex, std::system_error con un codice di errore di std::errc::operation_not_permittedOriginal:If there is no associated mutex, std::system_error with an error code of std::errc::operation_not_permittedThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- Se il mutex è già bloccato, std::system_error con un codice di errore di std::errc::resource_deadlock_would_occurOriginal:If the mutex is already locked, std::system_error with an error code of std::errc::resource_deadlock_would_occurThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[modifica]Esempio
This section is incomplete Reason: no example |
[modifica]Vedi anche
locks the associated mutex (metodo pubblico) | |
prova a bloccare il mutex associato, restituisce se il mutex non è disponibile Original: tries to lock the associated 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) | |
cerca di bloccare il mutex associato TimedLockable , restituisce se il mutex è stato disponibile fino al punto di tempo specificato è stato raggiunto Original: tries to lock the associated TimedLockable 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. (metodo pubblico) | |
sblocca il mutex associato Original: unlocks the associated mutex The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) |