1 //
2 // Copyright(c) 2015 Gabi Melman.
3 // Distributed under the MIT License (http://opensource.org/licenses/MIT)
4 //
5 
6 #pragma once
7 
8 #include <atomic>
9 // null, no cost dummy "mutex" and dummy "atomic" int
10 
11 namespace spdlog {
12 namespace details {
13 struct null_mutex
14 {
lockspdlog::details::null_mutex15     void lock() {}
unlockspdlog::details::null_mutex16     void unlock() {}
try_lockspdlog::details::null_mutex17     bool try_lock()
18     {
19         return true;
20     }
21 };
22 
23 struct null_atomic_int
24 {
25     int value;
26     null_atomic_int() = default;
27 
null_atomic_intspdlog::details::null_atomic_int28     explicit null_atomic_int(int val)
29         : value(val)
30     {
31     }
32 
loadspdlog::details::null_atomic_int33     int load(std::memory_order) const
34     {
35         return value;
36     }
37 
storespdlog::details::null_atomic_int38     void store(int val)
39     {
40         value = val;
41     }
42 };
43 
44 } // namespace details
45 } // namespace spdlog
46