-
Notifications
You must be signed in to change notification settings - Fork 7
timed_named_mutex try_lock_for
Alairion edited this page May 8, 2021
·
4 revisions
nes::timed_named_mutex::try_lock_until
template<class Rep, class Period>
(1) bool try_lock_for(const std::chrono::duration<Rep, Period>& timeout);
- Tries to lock the mutex. Blocks until specified timeout has elapsed or the lock is acquired.
Name | Description |
---|---|
timeout |
A std::chrono::duration representing the minimum time to wait for |
- Returns
true
if the mutex was acquired,false
otherwise.
- The calling thread must not own the mutex.
- Throws a
std::runtime_error
if the lock operation fails.
- On Windows, calls
WaitForSingleObject
with a timeout equal to the conversion of the duration to milliseconds (rounded down)
On Posix systems, callspthread_mutex_timedlock