Zth (libzth)
|
Singleton pattern, but only per-thread. More...
#include <util.h>
Public Types | |
typedef T | singleton_type |
Alias of the T template parameter. More... | |
Static Public Member Functions | |
static safe_ptr< singleton_type >::type | instance () noexcept |
Return the only instance of T within this thread. More... | |
Protected Member Functions | |
ThreadLocalSingleton () | |
Constructor. More... | |
~ThreadLocalSingleton () | |
Destructor. More... | |
Singleton pattern, but only per-thread.
This is the same as the zth::Singleton class, except that the instance is saved in thread-local storage.
T | the type of the subclass that inherits this ThreadLocalSingleton. |
typedef T zth::ThreadLocalSingleton< T >::singleton_type |
|
inlineprotected |
|
inlineprotected |
Destructor.
After destruction, instance() will return nullptr
.
|
inlinestaticnoexcept |