Constructs a lock and tries to acquire the mutex within a duration.

Synopsis

Declared in <folly/SharedMutex.h>

template<
    typename Rep,
    typename Period>
[[nodiscard]]
shared_lock(
    mutex_type& mutex,
    std::chrono::duration<Rep, Period> const& timeout);

Return Value

Note

The return value should not be discarded.

Parameters

Name

Description

mutex

Mutex to try to lock.

timeout

Maximum time to wait for the lock.

Created with MrDocs