[#std-shared_lock-0b-2constructor-00e]
= xref:std.adoc[std]::xref:std/shared_lock-0b.adoc[shared&lowbar;lock&lt;folly::SharedMutexImpl&lt;ReaderPriority, Tag&lowbar;, Atom, Policy&gt;&gt;]::shared&lowbar;lock
:relfileprefix: ../../
:mrdocs:

Constructs a lock and tries to acquire the mutex within a duration&period;

== Synopsis

Declared in `&lt;folly&sol;SharedMutex&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Rep,
    typename Period&gt;
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
shared&lowbar;lock(
    xref:std/shared_lock-0b/mutex_type.adoc[mutex&lowbar;type]& mutex,
    std::chrono::duration&lt;Rep, Period&gt; 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&period;
| *timeout*
| Maximum time to wait for the lock&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
