chsvlib
chsv helper source code
shared_lock< Mutex > Class Template Reference

Implements std::shared_lock interface of C++14. More...

#include <chsvthrd.h>

Public Types

typedef Mutex mutex_type
 The underlying shared_mutex.
 

Public Member Functions

 shared_lock ()=default
 Default constructor which creates a shared_lock object with no associated mutex.
 
 shared_lock (shared_lock &&other) noexcept
 A move constructor. More...
 
 shared_lock (mutex_type &m)
 A constructor associating the specified shared_mutex with the shared_lock object. The utex is locked by the constructor for shared ownership. More...
 
 shared_lock (mutex_type &m, std::defer_lock_t t) noexcept
 A constructor associating the specified shared_mutex with the shared_lock object. The mutex is not locked. More...
 
 shared_lock (mutex_type &m, std::try_to_lock_t t)
 A constructor associating the specified shared_mutex with the shared_lock object. The constructor attempts to gain ownership of the mutex calling the shared_mutex::try_lock_shared method. Use the shared_lock::owns_lock method to acquire the result. More...
 
 shared_lock (mutex_type &m, std::adopt_lock_t t)
 A constructor associating the specified shared_mutex with the shared_lock object. The constructor assumes that the mutex is already locked by the calling thread. More...
 
 ~shared_lock ()
 The destructor. If the shared_lock object owns an associated mutex, its shared_mutex::unlock_shared is called.
 
shared_lockoperator= (shared_lock &&other) noexcept
 Transfers ownership of a mutex from another shared_lock object and leaves the other object with no associated mutex. More...
 
void lock ()
 Calls shared_mutex::lock_shared.
 
bool try_lock ()
 Calls shared_mutex::try_lock_shared and returns the result.
 
void unlock ()
 Calls shared_mutex::unlock_shared.
 
void swap (shared_lock &other) noexcept
 Swaps state of the shared_lock object with another one. More...
 
mutex_typerelease () noexcept
 Returns a pointer to the underlying shared_mutex object in its current state, or null if no mutex is associated with the shared_lock object, and leaves the object with no associated mutex. More...
 
mutex_typemutex () const noexcept
 Returns a pointer to the underlying shared_mutex object. More...
 
bool owns_lock () const noexcept
 Checks whether the current shared_lock owns its mutex object. More...
 
 operator bool () const noexcept
 Checks whether the current shared_lock owns its mutex object. More...
 

Detailed Description

template<class Mutex>
class Chusov::ExecutionControl::shared_lock< Mutex >

Implements std::shared_lock interface of C++14.

Template Parameters
Mutexa shared_mutex object (e.g. shared_mutex) which satisfies requirements of SharedMutex.

The documentation for this class was generated from the following file: