folly::SharedMutexImpl::try_lock_for

Tries to acquire the lock in exclusive mode within a duration.

Synopsis

Declared in <folly/SharedMutex.h>

template<
    class Rep,
    class Period>
bool
try_lock_for(std::chrono::duration<Rep, Period> const& duration);

Return Value

true if the lock was acquired before the duration elapsed.

Parameters

NameDescription
durationMaximum time to wait for the lock.