Singleton with double-checked locking pattern with atomic and mutex lock. More...

#include <mn_atomic_singleton.hpp>

+ Collaboration diagram for mn::basic_atomic_singleton< T >:

Public Types

using value_type = T
 
using reference = value_type &
 
using pointer = T *
 
using self_type = basic_atomic_singleton< T >
 

Public Member Functions

 basic_atomic_singleton (self_type &&other)=delete
 
 basic_atomic_singleton (const self_type &)=delete
 

Static Public Member Functions

static reference instance ()
 

Static Private Attributes

static mn::_atomic< pointerm_pInstance
 
static mn::mutex_t m_tLock
 

Friends

class T
 

Detailed Description

template<typename T>
class mn::basic_atomic_singleton< T >

Singleton with double-checked locking pattern with atomic and mutex lock.

Template Parameters
TThe type of the class to be make as singleton.

Member Typedef Documentation

◆ pointer

template<typename T >
using mn::basic_atomic_singleton< T >::pointer = T*

◆ reference

template<typename T >
using mn::basic_atomic_singleton< T >::reference = value_type&

◆ self_type

template<typename T >
using mn::basic_atomic_singleton< T >::self_type = basic_atomic_singleton<T>

◆ value_type

template<typename T >
using mn::basic_atomic_singleton< T >::value_type = T

Constructor & Destructor Documentation

◆ basic_atomic_singleton() [1/2]

template<typename T >
mn::basic_atomic_singleton< T >::basic_atomic_singleton ( self_type &&  other)
delete

◆ basic_atomic_singleton() [2/2]

template<typename T >
mn::basic_atomic_singleton< T >::basic_atomic_singleton ( const self_type )
delete

Member Function Documentation

◆ instance()

template<typename T >
static reference mn::basic_atomic_singleton< T >::instance ( )
inlinestatic

Friends And Related Function Documentation

◆ T

template<typename T >
friend class T
friend

Member Data Documentation

◆ m_pInstance

template<typename T >
mn::_atomic< T * > mn::basic_atomic_singleton< T >::m_pInstance
staticprivate

◆ m_tLock

template<typename T >
mn::mutex_t mn::basic_atomic_singleton< T >::m_tLock
staticprivate

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