![]() |
Scarab
v3.9.1
Project 8 C++ Utility Library
|
Base class that turns a class into a thread-local singleton. More...
#include <thread_singleton.hh>
Static Public Member Functions | |
static x_type * | get_instance () |
static void | kill_instance () |
template<class... x_args> | |
static x_type * | create_instance (x_args... args) |
Protected Member Functions | |
thread_singleton () | |
~thread_singleton () | |
Static Protected Attributes | |
static thread_local std::mutex | f_mutex |
Static Private Member Functions | |
static void | construct_instance () |
static void | delete_instance () |
Static Private Attributes | |
static thread_local x_type * | f_instance = nullptr |
static thread_local destroyer< x_type > | f_destroyer |
Friends | |
class | destroyer< x_type > |
Base class that turns a class into a thread-local singleton.
A thread-local singleton is similar to a singleton except that a different instance exists in each thread.
To use:
allow_thread_singleton_access( your_class )
macro to your class definition to allow the base classes to access your classThe mutex f_mutex provides thread safety for creation and destruction of an instance of the thread_singleton. It's available to the derived class for thread-safe access to the object in general.
Definition at line 45 of file thread_singleton.hh.
|
protected |
Definition at line 139 of file thread_singleton.hh.
|
protected |
Definition at line 143 of file thread_singleton.hh.
|
staticprivate |
Definition at line 118 of file thread_singleton.hh.
|
static |
Definition at line 105 of file thread_singleton.hh.
|
staticprivate |
Definition at line 128 of file thread_singleton.hh.
|
static |
Definition at line 82 of file thread_singleton.hh.
|
static |
Definition at line 93 of file thread_singleton.hh.
|
friend |
Definition at line 68 of file thread_singleton.hh.
|
staticprivate |
Definition at line 60 of file thread_singleton.hh.
|
staticprivate |
Definition at line 59 of file thread_singleton.hh.
|
staticprotected |
Definition at line 63 of file thread_singleton.hh.