Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::nested_strict_lock< Lock > Class Template Reference

A nested strict lock is a scoped lock guard ensuring the mutex is locked on its scope, by taking ownership of an nesting lock, locking the mutex on construction if not already locked and restoring the ownership to the nesting lock on destruction. More...

#include <strict_lock.hpp>

Public Types

typedef Lock::mutex_type mutex_type
 

Public Member Functions

 nested_strict_lock (Lock &lk)
 Constructor from a nesting Lock. More...
 
 nested_strict_lock (std::initializer_list< thread_detail::lockable_wrapper< Lock > > l_)
 
 ~nested_strict_lock () BOOST_NOEXCEPT
 Destructor. More...
 
mutex_typemutex () const BOOST_NOEXCEPT
 return the owned mutex. More...
 
bool owns_lock () const BOOST_NOEXCEPT
 
bool owns_lock (mutex_type const *l) const BOOST_NOEXCEPT
 

Detailed Description

template<typename Lock>
class boost::nested_strict_lock< Lock >

A nested strict lock is a scoped lock guard ensuring the mutex is locked on its scope, by taking ownership of an nesting lock, locking the mutex on construction if not already locked and restoring the ownership to the nesting lock on destruction.

Member Typedef Documentation

template<typename Lock >
typedef Lock::mutex_type boost::nested_strict_lock< Lock >::mutex_type

Constructor & Destructor Documentation

template<typename Lock >
boost::nested_strict_lock< Lock >::nested_strict_lock ( Lock lk)
inlineexplicit

Constructor from a nesting Lock.

Parameters
lkthe nesting lock

__Requires: lk.mutex() != null_ptr __Effects: Stores the reference to the lock parameter and takes ownership on it. If the lock doesn't owns the mutex mtx lock it. __Postconditions: owns_lock(lk.mutex()) __StrongException __Throws:

  • lock_error when BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED is defined and lk.mutex() == null_ptr
  • Any exception that lk.lock() can throw.

References boost::interprocess::lock_error, and boost::move().

template<typename Lock >
boost::nested_strict_lock< Lock >::nested_strict_lock ( std::initializer_list< thread_detail::lockable_wrapper< Lock > >  l_)
inline
template<typename Lock >
boost::nested_strict_lock< Lock >::~nested_strict_lock ( )
inline

Destructor.

__Effects: Restores ownership to the nesting lock.

References boost::move().

Member Function Documentation

template<typename Lock >
mutex_type* boost::nested_strict_lock< Lock >::mutex ( ) const
inline

return the owned mutex.

Referenced by boost::nested_strict_lock< Lock >::owns_lock().

template<typename Lock >
bool boost::nested_strict_lock< Lock >::owns_lock ( ) const
inline
Returns
whether this lock is locking a mutex.
template<typename Lock >
bool boost::nested_strict_lock< Lock >::owns_lock ( mutex_type const *  l) const
inline
Returns
whether if this lock is locking that mutex.

References boost::nested_strict_lock< Lock >::mutex().


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