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

std&colon;&colon;shared&lowbar;lock specialization for folly&colon;&colon;SharedMutexImpl&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    bool ReaderPriority,
    typename Tag&lowbar;,
    template&lt;typename&gt; typename Atom,
    typename Policy&gt;
class xref:std/shared_lock-06.adoc[shared&lowbar;lock]&lt;xref:folly/SharedMutexImpl-09.adoc[folly::SharedMutexImpl&lt;ReaderPriority, Tag&lowbar;, Atom, Policy&gt;]&gt;;
----

== Description

Uses the tokenful version of unlock&lowbar;shared for faster unlocking by carrying a token that records where the shared lock was taken&period;

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:std/shared_lock-0b/mutex_type.adoc[`mutex&lowbar;type`] 
| The mutex type this lock manages&period;
| xref:std/shared_lock-0b/token_type.adoc[`token&lowbar;type`] 
| The token type used to record the shared lock&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:std/shared_lock-0b/2constructor-0c.adoc[`shared&lowbar;lock`]         [.small]#[constructor]#
| Constructors
| xref:std/shared_lock-0b/2destructor.adoc[`&#126;shared&lowbar;lock`] [.small]#[destructor]#
| Releases the shared lock if it is held&period;
| xref:std/shared_lock-0b/operator_assign-06.adoc[`operator&equals;`] 
| Assignment operators
| xref:std/shared_lock-0b/lock.adoc[`lock`] 
| Acquires the managed mutex in shared mode&period;
| xref:std/shared_lock-0b/mutex.adoc[`mutex`] 
| Returns the managed mutex without releasing ownership&period;
| xref:std/shared_lock-0b/owns_lock.adoc[`owns&lowbar;lock`] 
| Reports whether this lock currently owns a shared lock&period;
| xref:std/shared_lock-0b/release.adoc[`release`] 
| Releases ownership of the managed mutex without unlocking it&period;
| xref:std/shared_lock-0b/swap.adoc[`swap`] 
| Swaps the managed mutex and token with another lock&period;
| xref:std/shared_lock-0b/try_lock.adoc[`try&lowbar;lock`] 
| Tries to acquire the managed mutex in shared mode without blocking&period;
| xref:std/shared_lock-0b/try_lock_for.adoc[`try&lowbar;lock&lowbar;for`] 
| Tries to acquire the managed mutex in shared mode within a duration&period;
| xref:std/shared_lock-0b/try_lock_until.adoc[`try&lowbar;lock&lowbar;until`] 
| Tries to acquire the managed mutex in shared mode by a deadline&period;
| xref:std/shared_lock-0b/unlock.adoc[`unlock`] 
| Releases the managed shared lock&period;
| xref:std/shared_lock-0b/2conversion.adoc[`operator bool`] 
| Reports whether this lock currently owns a shared lock&period;
|===


== Template Parameters

[cols="1,4"]
|===
| Name| Description
| *ReaderPriority*
| Whether the mutex gives priority to readers&period;
| *Tag&lowbar;*
| Tag type of the mutex instantiation&period;
| *Atom*
| Atomic template used by the mutex&period;
| *Policy*
| Policy type of the mutex&period;
|===


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