Constructors
Synopses
Declared in <folly/SharedMutex.h>
Constructs a lock that owns no mutex.
shared_lock() noexcept = default;
Deleted copy constructor; the lock is not copyable.
shared_lock(shared_lock const& other) = delete;
Move‐constructs a lock, transferring ownership from another lock.
shared_lock(shared_lock&& other) noexcept;
Constructs a lock and acquires the mutex in shared mode.
[[nodiscard]]
explicit
shared_lock(mutex_type& mutex);
Constructs a lock that adopts an already‐held shared lock.
[[nodiscard]]
shared_lock(
mutex_type& mutex,
std::adopt_lock_t unused);
Constructs a lock that manages a mutex without acquiring it.
shared_lock(
mutex_type& mutex,
std::defer_lock_t unused) noexcept;
Constructs a lock and tries to acquire the mutex without blocking.
[[nodiscard]]
shared_lock(
mutex_type& mutex,
std::try_to_lock_t unused);
Constructs a lock and tries to acquire the mutex within a duration.
template<
typename Rep,
typename Period>
[[nodiscard]]
shared_lock(
mutex_type& mutex,
std::chrono::duration<Rep, Period> const& timeout);
Constructs a lock and tries to acquire the mutex by a deadline.
template<
typename Clock,
typename Duration>
[[nodiscard]]
shared_lock(
mutex_type& mutex,
std::chrono::time_point<Clock, Duration> const& deadline);
Parameters
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. |
Created with MrDocs