[#std-shared_lock-0b-2constructor-00e] = xref:std.adoc[std]::xref:std/shared_lock-0b.adoc[shared_lock<folly::SharedMutexImpl<ReaderPriority, Tag_, Atom, Policy>>]::shared_lock :relfileprefix: ../../ :mrdocs: Constructs a lock and tries to acquire the mutex within a duration. == Synopsis Declared in `<folly/SharedMutex.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename Rep, typename Period> [[nodiscard]] shared_lock( xref:std/shared_lock-0b/mutex_type.adoc[mutex_type]& mutex, std::chrono::duration<Rep, Period> const& timeout); ---- == Return Value [NOTE] ==== The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^]. ==== == Parameters [cols="1,4"] |=== | Name| Description | *mutex* | Mutex to try to lock. | *timeout* | Maximum time to wait for the lock. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#