SDRAngel
4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
sdrbase
util
threadsafesingleton.h
Go to the documentation of this file.
1
/*
2
* threadsafesingleton.h
3
*
4
* Created on: Aug 7, 2015
5
* Author: f4exb
6
*/
7
8
#ifndef INCLUDE_UTIL_THREADSAFESINGLETON_H_
9
#define INCLUDE_UTIL_THREADSAFESINGLETON_H_
10
12
22
template
<
class
S>
class
ThreadSafeSingleton
23
{
24
public
:
25
static
S&
instance
() {
return
*
_pInstance
; }
26
27
protected
:
28
ThreadSafeSingleton
() {}
29
~ThreadSafeSingleton
() {
delete
_pInstance
; }
30
static
S*
_pInstance
;
31
32
private
:
33
ThreadSafeSingleton
(
const
ThreadSafeSingleton
&) {}
34
ThreadSafeSingleton
&
operator =
(
const
ThreadSafeSingleton
&) {
return
*
this
;}
35
};
36
37
template
<
class
S> S *
ThreadSafeSingleton<S>::_pInstance
=
new
S;
38
39
#endif
/* INCLUDE_UTIL_THREADSAFESINGLETON_H_ */
ThreadSafeSingleton::ThreadSafeSingleton
ThreadSafeSingleton(const ThreadSafeSingleton &)
Definition:
threadsafesingleton.h:33
ThreadSafeSingleton
Template class used to make from a class a singleton.
Definition:
threadsafesingleton.h:22
ThreadSafeSingleton::~ThreadSafeSingleton
~ThreadSafeSingleton()
Definition:
threadsafesingleton.h:29
ThreadSafeSingleton::_pInstance
static S * _pInstance
Definition:
threadsafesingleton.h:30
ThreadSafeSingleton::operator=
ThreadSafeSingleton & operator=(const ThreadSafeSingleton &)
Definition:
threadsafesingleton.h:34
ThreadSafeSingleton::instance
static S & instance()
Definition:
threadsafesingleton.h:25
ThreadSafeSingleton::ThreadSafeSingleton
ThreadSafeSingleton()
Definition:
threadsafesingleton.h:28
Generated on Fri Aug 2 2019 17:56:33 for SDRAngel by
1.8.13