| The Gaudi Framework v30r0 (c919700c)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Attributes | List of all members
boost::threadpool::detail::locking_ptr< T, Mutex > Class Template Reference

Smart pointer with a scoped locking mechanism. More...

`#include <src/threadpool/boost/threadpool/detail/locking_ptr.hpp>`

Inheritance diagram for boost::threadpool::detail::locking_ptr< T, Mutex >:
[legend]
Collaboration diagram for boost::threadpool::detail::locking_ptr< T, Mutex >:
[legend]

## Public Member Functions
| locking_ptr (volatile T &obj, const volatile Mutex &mtx)
| Constructor. More...
| ~locking_ptr ()
| Destructor. More...
T & | operator* () const
| Returns a reference to the stored instance. More...
T * | operator-> () const
| Returns a pointer to the stored instance. More...

## Private Attributes
T * | m_obj
| The instance pointer. More...
Mutex & | m_mutex
| Mutex is used for scoped locking. More...

## Detailed Description

### template<typename T, typename Mutex>
class boost::threadpool::detail::locking_ptr< T, Mutex >

Smart pointer with a scoped locking mechanism.

This class is a wrapper for a volatile pointer. It enables synchronized access to the internal pointer by locking the passed mutex.

Definition at line 37 of file locking_ptr.hpp.

## Constructor & Destructor Documentation

template<typename T, typename Mutex>

boost::threadpool::detail::locking_ptr< T, Mutex >::locking_ptr | ( | volatile T & | obj,
|  | const volatile Mutex & | mtx
| ) |  |
| inline

Constructor.

Definition at line 45 of file locking_ptr.hpp.

46 : m_obj(const_cast<T*>(&obj))
47 , m_mutex(*const_cast<Mutex*>(&mtx))
48 {
49 // Lock mutex
50 m_mutex.lock();
51 }
boost::threadpool::detail::locking_ptr::m_mutex
Mutex & m_mutex
Mutex is used for scoped locking.
Definition: locking_ptr.hpp:41
boost::threadpool::detail::locking_ptr::m_obj
T * m_obj
The instance pointer.
Definition: locking_ptr.hpp:40
template<typename T, typename Mutex>

boost::threadpool::detail::locking_ptr< T, Mutex >::~locking_ptr | ( |  | ) |
| inline

Destructor.

Definition at line 55 of file locking_ptr.hpp.

56 {
57 // Unlock mutex
58 m_mutex.unlock();
59 }
boost::threadpool::detail::locking_ptr::m_mutex
Mutex & m_mutex
Mutex is used for scoped locking.
Definition: locking_ptr.hpp:41

## Member Function Documentation

template<typename T, typename Mutex>

T& boost::threadpool::detail::locking_ptr< T, Mutex >::operator* | ( |  | ) | const
| inline

Returns a reference to the stored instance.

Returns
  The instance's reference.

Definition at line 65 of file locking_ptr.hpp.

66 {
67 return *m_obj;
68 }
boost::threadpool::detail::locking_ptr::m_obj
T * m_obj
The instance pointer.
Definition: locking_ptr.hpp:40
template<typename T, typename Mutex>

T* boost::threadpool::detail::locking_ptr< T, Mutex >::operator-> | ( |  | ) | const
| inline

Returns a pointer to the stored instance.

Returns
  The instance's pointer.

Definition at line 74 of file locking_ptr.hpp.

75 {
76 return m_obj;
77 }
boost::threadpool::detail::locking_ptr::m_obj
T * m_obj
The instance pointer.
Definition: locking_ptr.hpp:40

## Member Data Documentation

template<typename T, typename Mutex>

Mutex& boost::threadpool::detail::locking_ptr< T, Mutex >::m_mutex
| private

Mutex is used for scoped locking.

Definition at line 41 of file locking_ptr.hpp.

template<typename T, typename Mutex>

T* boost::threadpool::detail::locking_ptr< T, Mutex >::m_obj
| private

The instance pointer.

Definition at line 40 of file locking_ptr.hpp.

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

- GaudiMTTools/src/threadpool/boost/threadpool/detail/locking_ptr.hpp