DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
ers::SingletonCreator< class > Class Template Reference

#include <SingletonCreator.hpp>

Static Public Member Functions

static T * create ()
 

Static Private Attributes

static std::mutex s_mutex
 
static T * s_instance
 

Detailed Description

template<class>
class ers::SingletonCreator< class >

Definition at line 39 of file StreamManager.hpp.

Member Function Documentation

◆ create()

template<class >
static T * ers::SingletonCreator< class >::create ( )
inlinestatic

Definition at line 29 of file SingletonCreator.hpp.

30 {
31 // on MacOS with gcc 4.2 the s_mutex is not yet created
32 // at this moment which causes crash. This might be fixed
33 // when movining to newer gcc version
34 #if !defined( __APPLE__) && !defined(__rtems__)
35 std::scoped_lock lock(s_mutex);
36 #endif
37 if ( !s_instance )
38 {
39 s_instance = new T();
40 }
41 return s_instance;
42 }
static std::mutex s_mutex

Member Data Documentation

◆ s_instance

template<class T >
T * ers::SingletonCreator< T >::s_instance
staticprivate

Definition at line 26 of file SingletonCreator.hpp.

◆ s_mutex

template<class T >
std::mutex ers::SingletonCreator< T >::s_mutex
staticprivate

Definition at line 25 of file SingletonCreator.hpp.


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