[#std-shared_lock-0b-2constructor-0c] = xref:std.adoc[std]::xref:std/shared_lock-0b.adoc[shared_lock<folly::SharedMutexImpl<ReaderPriority, Tag_, Atom, Policy>>]::shared_lock :relfileprefix: ../../ :mrdocs: Constructors == Synopses Declared in `<folly/SharedMutex.h>` Constructs a lock that owns no mutex. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:std/shared_lock-0b/2constructor-04.adoc[shared_lock]() noexcept = default; ---- [.small]#xref:std/shared_lock-0b/2constructor-04.adoc[_» more..._]# Deleted copy constructor; the lock is not copyable. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:std/shared_lock-0b/2constructor-07d.adoc[shared_lock](xref:std/shared_lock-0b.adoc[shared_lock] const& other) = delete; ---- [.small]#xref:std/shared_lock-0b/2constructor-07d.adoc[_» more..._]# Move‐constructs a lock, transferring ownership from another lock. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:std/shared_lock-0b/2constructor-00b.adoc[shared_lock](xref:std/shared_lock-0b.adoc[shared_lock]&& other) noexcept; ---- [.small]#xref:std/shared_lock-0b/2constructor-00b.adoc[_» more..._]# Constructs a lock and acquires the mutex in shared mode. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard]] explicit xref:std/shared_lock-0b/2constructor-0d.adoc[shared_lock](xref:std/shared_lock-0b/mutex_type.adoc[mutex_type]& mutex); ---- [.small]#xref:std/shared_lock-0b/2constructor-0d.adoc[_» more..._]# Constructs a lock that adopts an already‐held shared lock. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard]] xref:std/shared_lock-0b/2constructor-05.adoc[shared_lock]( xref:std/shared_lock-0b/mutex_type.adoc[mutex_type]& mutex, std::adopt_lock_t unused); ---- [.small]#xref:std/shared_lock-0b/2constructor-05.adoc[_» more..._]# Constructs a lock that manages a mutex without acquiring it. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:std/shared_lock-0b/2constructor-0a.adoc[shared_lock]( xref:std/shared_lock-0b/mutex_type.adoc[mutex_type]& mutex, std::defer_lock_t unused) noexcept; ---- [.small]#xref:std/shared_lock-0b/2constructor-0a.adoc[_» more..._]# Constructs a lock and tries to acquire the mutex without blocking. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard]] xref:std/shared_lock-0b/2constructor-08.adoc[shared_lock]( xref:std/shared_lock-0b/mutex_type.adoc[mutex_type]& mutex, std::try_to_lock_t unused); ---- [.small]#xref:std/shared_lock-0b/2constructor-08.adoc[_» more..._]# Constructs a lock and tries to acquire the mutex within a duration. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename Rep, typename Period> [[nodiscard]] xref:std/shared_lock-0b/2constructor-00e.adoc[shared_lock]( xref:std/shared_lock-0b/mutex_type.adoc[mutex_type]& mutex, std::chrono::duration<Rep, Period> const& timeout); ---- [.small]#xref:std/shared_lock-0b/2constructor-00e.adoc[_» more..._]# Constructs a lock and tries to acquire the mutex by a deadline. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename Clock, typename Duration> [[nodiscard]] xref:std/shared_lock-0b/2constructor-078.adoc[shared_lock]( xref:std/shared_lock-0b/mutex_type.adoc[mutex_type]& mutex, std::chrono::time_point<Clock, Duration> const& deadline); ---- [.small]#xref:std/shared_lock-0b/2constructor-078.adoc[_» more..._]# == Parameters [cols="1,4"] |=== | Name| Description | *other* | The lock that would be copied from. | *mutex* | Mutex to lock. | *unused* | Tag selecting lock adoption. | *timeout* | Maximum time to wait for the lock. | *deadline* | Absolute time by which the lock must be acquired. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#