8 #ifndef SCARAB_THREAD_SINGLETON_HH_ 9 #define SCARAB_THREAD_SINGLETON_HH_ 24 #define allow_thread_singleton_access( class_name ) \ 25 friend class scarab::thread_singleton< class_name >; \ 26 friend class scarab::destroyer< class_name >; 44 template<
class x_type >
51 template<
class... x_args >
72 template<
class x_type >
75 template<
class x_type >
78 template<
class x_type >
81 template<
class x_type >
86 std::unique_lock< std::mutex > t_lock(
f_mutex );
92 template<
class x_type >
97 std::unique_lock< std::mutex > t_lock(
f_mutex );
103 template<
class x_type >
104 template<
class... x_args >
109 throw error() <<
"Instance already exists; create_instance can only be called before the instance exists";
111 std::unique_lock< std::mutex > t_lock(
f_mutex );
117 template<
class x_type >
127 template<
class x_type >
138 template<
class x_type >
142 template<
class x_type >
void set_doomed(XDoomed *)
static x_type * create_instance(x_args... args)
static void delete_instance()
static x_type * get_instance()
static void kill_instance()
static void construct_instance()
static thread_local std::mutex f_mutex
Base class that turns a class into a thread-local singleton.
static thread_local destroyer< x_type > f_destroyer
static thread_local x_type * f_instance