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

unique lock providing a pointer access to the synchronized value type. More...

#include <synchronized_value.hpp>

Inheritance diagram for boost::unique_lock_ptr< T, Lockable >:
Collaboration diagram for boost::unique_lock_ptr< T, Lockable >:

Public Types

typedef T value_type
 
typedef Lockable mutex_type
 

Public Member Functions

 unique_lock_ptr (T &val, Lockable &mtx)
 
 unique_lock_ptr (T &value, Lockable &mtx, adopt_lock_t) BOOST_NOEXCEPT
 
 unique_lock_ptr (T &value, Lockable &mtx, defer_lock_t) BOOST_NOEXCEPT
 
 unique_lock_ptr (T &value, Lockable &mtx, try_to_lock_t) BOOST_NOEXCEPT
 
 unique_lock_ptr (BOOST_THREAD_RV_REF(unique_lock_ptr) other) BOOST_NOEXCEPT
 Move constructor. More...
 
 ~unique_lock_ptr ()
 
Toperator-> ()
 
Toperator* ()
 
const Toperator-> () const
 
const Toperator* () const
 
void swap (unique_lock &other) BOOST_NOEXCEPT
 
void lock ()
 
bool try_lock ()
 
void unlock ()
 
 operator bool () const BOOST_NOEXCEPT
 
bool owns_lock () const BOOST_NOEXCEPT
 
Lockablemutex () const BOOST_NOEXCEPT
 
Lockablerelease () BOOST_NOEXCEPT
 

Protected Attributes

T const & value_
 

Detailed Description

template<typename T, typename Lockable = mutex>
class boost::unique_lock_ptr< T, Lockable >

unique lock providing a pointer access to the synchronized value type.

Parameters
Tthe value type.
Lockablethe mutex type protecting the value type.

Member Typedef Documentation

template<typename T , typename Lockable = mutex>
typedef Lockable boost::unique_lock_ptr< T, Lockable >::mutex_type
template<typename T , typename Lockable = mutex>
typedef T boost::unique_lock_ptr< T, Lockable >::value_type

Constructor & Destructor Documentation

template<typename T , typename Lockable = mutex>
boost::unique_lock_ptr< T, Lockable >::unique_lock_ptr ( T val,
Lockable mtx 
)
inline
Parameters
valuereference of the value to protect.
mtxreference to the mutex used to protect the value. locks the mutex mtx, stores a reference to it and to the value type value.
template<typename T , typename Lockable = mutex>
boost::unique_lock_ptr< T, Lockable >::unique_lock_ptr ( T value,
Lockable mtx,
adopt_lock_t   
)
inline
Parameters
valuereference of the value to protect.
mtxreference to the mutex used to protect the value.
tagof type adopt_lock_t used to differentiate the constructor. stores a reference to it and to the value type value taking ownership.
template<typename T , typename Lockable = mutex>
boost::unique_lock_ptr< T, Lockable >::unique_lock_ptr ( T value,
Lockable mtx,
defer_lock_t   
)
inline
Parameters
valuereference of the value to protect.
mtxreference to the mutex used to protect the value.
tagof type defer_lock_t used to differentiate the constructor. stores a reference to it and to the value type value c.
template<typename T , typename Lockable = mutex>
boost::unique_lock_ptr< T, Lockable >::unique_lock_ptr ( T value,
Lockable mtx,
try_to_lock_t   
)
inline
Parameters
valuereference of the value to protect.
mtxreference to the mutex used to protect the value.
tagof type try_to_lock_t used to differentiate the constructor. try to lock the mutex mtx, stores a reference to it and to the value type value.
template<typename T , typename Lockable = mutex>
boost::unique_lock_ptr< T, Lockable >::unique_lock_ptr ( BOOST_THREAD_RV_REF(unique_lock_ptr< T, Lockable >)  other)
inline

Move constructor.

takes ownership of the mutex owned by other, stores a reference to the mutex and the value type of other.

template<typename T , typename Lockable = mutex>
boost::unique_lock_ptr< T, Lockable >::~unique_lock_ptr ( )
inline

Member Function Documentation

Lockable * boost::unique_lock< Lockable >::mutex ( ) const
inlineinherited
boost::unique_lock< Lockable >::operator bool ( ) const
inlineexplicitinherited
template<typename T , typename Lockable = mutex>
const T& boost::const_unique_lock_ptr< T, Lockable >::operator* ( ) const
inlineinherited
Returns
a constant reference to the protected value

References BOOST_ASSERT, boost::unique_lock< Lockable >::owns_lock(), and boost::const_unique_lock_ptr< T, Lockable >::value_.

template<typename T , typename Lockable = mutex>
T& boost::unique_lock_ptr< T, Lockable >::operator* ( )
inline
template<typename T , typename Lockable = mutex>
const T* boost::const_unique_lock_ptr< T, Lockable >::operator-> ( ) const
inlineinherited
Returns
a constant pointer to the protected value

References BOOST_ASSERT, boost::unique_lock< Lockable >::owns_lock(), and boost::const_unique_lock_ptr< T, Lockable >::value_.

template<typename T , typename Lockable = mutex>
T* boost::unique_lock_ptr< T, Lockable >::operator-> ( )
inline
Lockable * boost::unique_lock< Lockable >::release ( )
inlineinherited
void boost::unique_lock< Lockable >::swap ( unique_lock< Lockable > &  other)
inlineinherited

Member Data Documentation


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