]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/interprocess/sync/null_mutex.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / interprocess / sync / null_mutex.hpp
1 //////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // See http://www.boost.org/libs/interprocess for documentation.
8 //
9 //////////////////////////////////////////////////////////////////////////////
10
11 #ifndef BOOST_INTERPROCESS_NULL_MUTEX_HPP
12 #define BOOST_INTERPROCESS_NULL_MUTEX_HPP
13
14 #ifndef BOOST_CONFIG_HPP
15 # include <boost/config.hpp>
16 #endif
17 #
18 #if defined(BOOST_HAS_PRAGMA_ONCE)
19 # pragma once
20 #endif
21
22 #include <boost/interprocess/detail/config_begin.hpp>
23 #include <boost/interprocess/detail/workaround.hpp>
24
25
26 //!\file
27 //!Describes null_mutex classes
28
29 namespace boost {
30 namespace interprocess {
31
32 //!Implements a mutex that simulates a mutex without doing any operation and
33 //!simulates a successful operation.
34 class null_mutex
35 {
36 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
37 null_mutex(const null_mutex&);
38 null_mutex &operator= (const null_mutex&);
39 #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
40 public:
41
42 //!Constructor.
43 //!Empty.
44 null_mutex() BOOST_NOEXCEPT {}
45
46 //!Destructor.
47 //!Empty.
48 ~null_mutex(){}
49
50 //!Simulates a mutex lock() operation. Empty function.
51 void lock(){}
52
53 //!Simulates a mutex try_lock() operation.
54 //!Equivalent to "return true;"
55 bool try_lock()
56 { return true; }
57
58 //!Simulates a mutex timed_lock() operation.
59 //!Equivalent to "return true;"
60 template<class TimePoint>
61 bool timed_lock(const TimePoint &)
62 { return true; }
63
64 //!Same as `timed_lock`, but this function is modeled after the
65 //!standard library interface.
66 template<class TimePoint>
67 bool try_lock_until(const TimePoint &)
68 { return true; }
69
70 //!Same as `timed_lock`, but this function is modeled after the
71 //!standard library interface.
72 template<class Duration>
73 bool try_lock_for(const Duration &)
74 { return true; }
75
76 //!Simulates a mutex unlock() operation.
77 //!Empty function.
78 void unlock(){}
79
80 //!Simulates a mutex lock_sharable() operation.
81 //!Empty function.
82 void lock_sharable(){}
83
84 //!Same as `lock_sharable` but with a std-compatible interface
85 //!
86 void lock_shared()
87 { this->lock_sharable(); }
88
89 //!Simulates a mutex try_lock_sharable() operation.
90 //!Equivalent to "return true;"
91 bool try_lock_sharable()
92 { return true; }
93
94 //!Same as `try_lock_sharable` but with a std-compatible interface
95 //!
96 bool try_lock_shared()
97 { return this->try_lock_sharable(); }
98
99 //!Simulates a mutex timed_lock_sharable() operation.
100 //!Equivalent to "return true;"
101 template<class TimePoint>
102 bool timed_lock_sharable(const TimePoint &)
103 { return true; }
104
105 //!Simulates a mutex unlock_sharable() operation.
106 //!Empty function.
107 void unlock_sharable(){}
108
109 //!Same as `unlock_sharable` but with a std-compatible interface
110 //!
111 void unlock_shared()
112 { this->unlock_sharable(); }
113
114 //!Simulates a mutex lock_upgradable() operation.
115 //!Empty function.
116 void lock_upgradable(){}
117
118 //!Simulates a mutex try_lock_upgradable() operation.
119 //!Equivalent to "return true;"
120 bool try_lock_upgradable()
121 { return true; }
122
123 //!Simulates a mutex timed_lock_upgradable() operation.
124 //!Equivalent to "return true;"
125 template<class TimePoint>
126 bool timed_lock_upgradable(const TimePoint &)
127 { return true; }
128
129 //!Simulates a mutex unlock_upgradable() operation.
130 //!Empty function.
131 void unlock_upgradable(){}
132
133 //!Simulates unlock_and_lock_upgradable().
134 //!Empty function.
135 void unlock_and_lock_upgradable(){}
136
137 //!Simulates unlock_and_lock_sharable().
138 //!Empty function.
139 void unlock_and_lock_sharable(){}
140
141 //!Simulates unlock_upgradable_and_lock_sharable().
142 //!Empty function.
143 void unlock_upgradable_and_lock_sharable(){}
144
145 //Promotions
146
147 //!Simulates unlock_upgradable_and_lock().
148 //!Empty function.
149 void unlock_upgradable_and_lock(){}
150
151 //!Simulates try_unlock_upgradable_and_lock().
152 //!Equivalent to "return true;"
153 bool try_unlock_upgradable_and_lock()
154 { return true; }
155
156 //!Simulates timed_unlock_upgradable_and_lock().
157 //!Equivalent to "return true;"
158 template<class TimePoint>
159 bool timed_unlock_upgradable_and_lock(const TimePoint &)
160 { return true; }
161
162 //!Simulates try_unlock_sharable_and_lock().
163 //!Equivalent to "return true;"
164 bool try_unlock_sharable_and_lock()
165 { return true; }
166
167 //!Simulates try_unlock_sharable_and_lock_upgradable().
168 //!Equivalent to "return true;"
169 bool try_unlock_sharable_and_lock_upgradable()
170 { return true; }
171 };
172
173 } //namespace interprocess {
174 } //namespace boost {
175
176 #include <boost/interprocess/detail/config_end.hpp>
177
178 #endif //BOOST_INTERPROCESS_NULL_MUTEX_HPP