mgcpp
A C++ Math Library Based on CUDA
global_context.hpp
Go to the documentation of this file.
1 
2 // Copyright RedPortal, mujjingun 2017 - 2018.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 
7 #ifndef _MGCPP_CONTEXT_GLOBAL_CONTEXT_HPP_
8 #define _MGCPP_CONTEXT_GLOBAL_CONTEXT_HPP_
9 
10 #include <initializer_list>
11 #include <memory>
12 #include <mutex>
13 #include <thread>
14 #include <unordered_map>
15 
17 
18 namespace mgcpp {
20  private:
21  std::mutex _mtx;
23  hash_table<std::thread::id, int> _context_ref_cnt;
24 
25  void reference_cnt_incr();
26 
27  public:
28  global_context() = default;
29 
30  global_context(global_context const& other) = delete;
31  global_context(global_context&& other) = delete;
32  global_context& operator=(global_context const& other) = delete;
33  global_context& operator=(global_context&& other) = delete;
34 
36 
37  static void reference_cnt_decr();
38 
40 };
41 } // namespace mgcpp
42 #endif
Definition: adapter_base.hpp:12
Definition: thread_context.hpp:20
Definition: global_context.hpp:19
std::unordered_map< T, U > hash_table
Definition: thread_context.hpp:18
global_context & operator=(global_context const &other)=delete
static void reference_cnt_decr()
static global_context & global_context_setting()
static thread_context & get_thread_context()