Condy v1.7.0
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
7#include "condy/utils.hpp"
8
9namespace condy {
10
11template <typename T> class ThreadLocalSingleton {
12public:
13 ThreadLocalSingleton() = default;
14
15 CONDY_DELETE_COPY_MOVE(ThreadLocalSingleton);
16
17 static T &current() noexcept {
18 static thread_local T instance;
19 return instance;
20 }
21};
22
23} // namespace condy
The main namespace for the Condy library.
Definition condy.hpp:31
Internal utility classes and functions used by Condy.