Condy v1.8
C++ Asynchronous System Call Layer for Linux
Loading...
Searching...
No Matches
singleton.hpp
Go to the documentation of this file.
1
4
5#pragma once
6
8
9namespace condy {
10namespace detail {
11
12template <typename T> class ThreadLocalSingleton {
13public:
14 CONDY_DELETE_COPY_MOVE(ThreadLocalSingleton);
15
16 static T &current() noexcept {
17 static thread_local T instance;
18 return instance;
19 }
20
21private:
22 ThreadLocalSingleton() = default;
23
24 friend T;
25};
26
27} // namespace detail
28} // namespace condy
The main namespace for the Condy library.
Definition condy.hpp:37
Internal utility classes and functions used by Condy.