![]() |
boost::sync::shared_lock — A shared lock scope guard.
// In header: <boost/sync/locks/shared_lock.hpp> template<typename Mutex> class shared_lock { public: // types typedef Mutex mutex_type; // construct/copy/destruct shared_lock() noexcept; explicit shared_lock(mutex_type &); shared_lock(mutex_type &, adopt_lock_t) noexcept; shared_lock(mutex_type &, defer_lock_t) noexcept; shared_lock(mutex_type &, try_to_lock_t); template<typename Time> shared_lock(unspecified, Time const &); shared_lock(shared_lock &&) noexcept; explicit shared_lock(unique_lock< mutex_type > &&); explicit shared_lock(upgrade_lock< mutex_type > &&); shared_lock & operator=(shared_lock &&) noexcept; shared_lock & operator=(unique_lock< mutex_type > &&); shared_lock & operator=(upgrade_lock< mutex_type > &&); ~shared_lock(); // public member functions void lock(); bool try_lock(); template<typename Time> unspecified timed_lock(Time const &); template<typename Duration> unspecified try_lock_for(Duration const &); template<typename TimePoint> unspecified try_lock_until(TimePoint const &); void unlock(); explicit operator bool() const; bool operator!() const noexcept; bool owns_lock() const noexcept; mutex_type * mutex() const noexcept; mutex_type * release() noexcept; void swap(shared_lock &) noexcept; };
A unique lock scope guard.
shared_lock
public
construct/copy/destructshared_lock() noexcept;
explicit shared_lock(mutex_type & m);
shared_lock(mutex_type & m, adopt_lock_t) noexcept;
shared_lock(mutex_type & m, defer_lock_t) noexcept;
shared_lock(mutex_type & m, try_to_lock_t);
template<typename Time> shared_lock(unspecified m, Time const & t);
shared_lock(shared_lock && that) noexcept;
explicit shared_lock(unique_lock< mutex_type > && that);
explicit shared_lock(upgrade_lock< mutex_type > && that);
shared_lock & operator=(shared_lock && that) noexcept;
shared_lock & operator=(unique_lock< mutex_type > && that);
shared_lock & operator=(upgrade_lock< mutex_type > && that);
~shared_lock();
shared_lock
public member functionsvoid lock();
bool try_lock();
template<typename Time> unspecified timed_lock(Time const & time);
template<typename Duration> unspecified try_lock_for(Duration const & rel_time);
template<typename TimePoint> unspecified try_lock_until(TimePoint const & abs_time);
void unlock();
explicit operator bool() const;
bool operator!() const noexcept;
bool owns_lock() const noexcept;
mutex_type * mutex() const noexcept;
mutex_type * release() noexcept;
void swap(shared_lock & that) noexcept;