aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/um/service/include/libservice/singleton.hpp
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2017-05-01 15:39:00 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2017-05-01 15:39:00 +0300
commit2293d0875ee3bb27b923d51550ff4ba4bf2b9669 (patch)
tree275efbfacceae4c40d47b749c1563e761a65c03f /um/service/include/libservice/singleton.hpp
parentservice: code style (diff)
downloadwindows7-drivers-2293d0875ee3bb27b923d51550ff4ba4bf2b9669.tar.gz
windows7-drivers-2293d0875ee3bb27b923d51550ff4ba4bf2b9669.zip
um: strip the 'lib' prefix from include/ dirs
Diffstat (limited to 'um/service/include/libservice/singleton.hpp')
-rw-r--r--um/service/include/libservice/singleton.hpp43
1 files changed, 0 insertions, 43 deletions
diff --git a/um/service/include/libservice/singleton.hpp b/um/service/include/libservice/singleton.hpp
deleted file mode 100644
index 1c7b1a7..0000000
--- a/um/service/include/libservice/singleton.hpp
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 2015 Egor Tensin <Egor.Tensin@gmail.com>
-// This file is part of the "Windows 7 drivers" project.
-// For details, see https://github.com/egor-tensin/windows7-drivers.
-// Distributed under the MIT License.
-
-#pragma once
-
-#include <mutex>
-
-namespace libservice
-{
- template <typename DerivedT>
- class Singleton
- {
- public:
- static DerivedT& get()
- {
- std::call_once(initialized, initialize);
- return get_unsafe();
- }
-
- protected:
- Singleton() = default;
- virtual ~Singleton() = default;
-
- private:
- static void initialize()
- {
- get_unsafe();
- }
-
- static DerivedT& get_unsafe()
- {
- static DerivedT instance;
- return instance;
- }
-
- static std::once_flag initialized;
- };
-
- template <typename DerivedT>
- std::once_flag Singleton<DerivedT>::initialized;
-}