[ Web Proxy ]
URL:
Viewing: https://ru.cppreference.com/cpp/thread/unique_lock/try_lock_for [Back]  [Original]

std::unique_lock::try_lock_for cppreference.com
cppreference.com

std::unique_lock::try_lock_for

cppreference.com

<metanoindex/>

 
C++
(C++20)
(C++20)
(C++11)
(C++20)
/
(C++11)
(C++11)
(C++11)
(C++17)
 
(C++11)
(C++20)
(C++20)
this_thread
(C++11)
(C++11)
(C++11)
(C++11)
(C++20)
(C++11)( C++20)
(C++11)( C++20)
(C++11)( C++20)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)(C++11)(C++11)
(C++11)
(C++11)
(C++11)
(C++20)
(C++20)
(C++11)
(C++11)
(C++11)
(C++11)
 
 
<tbody> </tbody>
template< class Rep, class Period > bool try_lock_for( const std::chrono::duration<Rep,Period>& timeout_duration );
( C++11)
. timeout_duration , . true , false. , timeout_duration.
:
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.
Google.
. .
mutex()->try_lock_for(timeout_duration)
:
Effectively calls mutex()->try_lock_for(timeout_duration)
Google.
. .
std::system_error , , .
:
std::system_error is thrown if there is no associated mutex or if the mutex is already locked.
Google.
. .

timeout_duration
:
maximum duration to block for
Google.
. .

true, , false.
:
true if the ownership of the mutex has been acquired successfully, false otherwise.
Google.
. .

  • , mutex()->try_lock_for(timeout_duration)
    :
    Any exceptions thrown by mutex()->try_lock_for(timeout_duration)
    Google.
    . .

.

locks the associated mutex
(public -) []
, , ,
:
tries to lock the associated mutex, returns if the mutex is not available
Google.
. .

(public -) []
TimedLockable, ,
:
tries to lock the associated TimedLockable mutex, returns if the mutex has been unavailable until specified time point has been reached
Google.
. .

(public -) []
:
unlocks the associated mutex
Google.
. .

(public -) []

Web Proxy Viewer  |  New URL  |  Original Page