]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/interprocess/sync/null_mutex.hpp
update sources to v12.2.3
[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
31 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
32
33 namespace posix_time
34 { class ptime; }
35
36 #endif //#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
37
38 namespace interprocess {
39
40 //!Implements a mutex that simulates a mutex without doing any operation and
41 //!simulates a successful operation.
42 class null_mutex
43 {
44 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
45 null_mutex(const null_mutex&);
46 null_mutex &operator= (const null_mutex&);
47 #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
48 public:
49
50 //!Constructor.
51 //!Empty.
52 null_mutex(){}
53
54 //!Destructor.
55 //!Empty.
56 ~null_mutex(){}
57
58 //!Simulates a mutex lock() operation. Empty function.
59 void lock(){}
60
61 //!Simulates a mutex try_lock() operation.
62 //!Equivalent to "return true;"
63 bool try_lock()
64 { return true; }
65
66 //!Simulates a mutex timed_lock() operation.
67 //!Equivalent to "return true;"
68 bool timed_lock(const boost::posix_time::ptime &)
69 { return true; }
70
71 //!Simulates a mutex unlock() operation.
72 //!Empty function.
73 void unlock(){}
74
75 //!Simulates a mutex lock_sharable() operation.
76 //!Empty function.
77 void lock_sharable(){}
78
79 //!Simulates a mutex try_lock_sharable() operation.
80 //!Equivalent to "return true;"
81 bool try_lock_sharable()
82 { return true; }
83
84 //!Simulates a mutex timed_lock_sharable() operation.
85 //!Equivalent to "return true;"
86 bool timed_lock_sharable(const boost::posix_time::ptime &)
87 { return true; }
88
89 //!Simulates a mutex unlock_sharable() operation.
90 //!Empty function.
91 void unlock_sharable(){}
92
93 //!Simulates a mutex lock_upgradable() operation.
94 //!Empty function.
95 void lock_upgradable(){}
96
97 //!Simulates a mutex try_lock_upgradable() operation.
98 //!Equivalent to "return true;"
99 bool try_lock_upgradable()
100 { return true; }
101
102 //!Simulates a mutex timed_lock_upgradable() operation.
103 //!Equivalent to "return true;"
104 bool timed_lock_upgradable(const boost::posix_time::ptime &)
105 { return true; }
106
107 //!Simulates a mutex unlock_upgradable() operation.
108 //!Empty function.
109 void unlock_upgradable(){}
110
111 //!Simulates unlock_and_lock_upgradable().
112 //!Empty function.
113 void unlock_and_lock_upgradable(){}
114
115 //!Simulates unlock_and_lock_sharable().
116 //!Empty function.
117 void unlock_and_lock_sharable(){}
118
119 //!Simulates unlock_upgradable_and_lock_sharable().
120 //!Empty function.
121 void unlock_upgradable_and_lock_sharable(){}
122
123 //Promotions
124
125 //!Simulates unlock_upgradable_and_lock().
126 //!Empty function.
127 void unlock_upgradable_and_lock(){}
128
129 //!Simulates try_unlock_upgradable_and_lock().
130 //!Equivalent to "return true;"
131 bool try_unlock_upgradable_and_lock()
132 { return true; }
133
134 //!Simulates timed_unlock_upgradable_and_lock().
135 //!Equivalent to "return true;"
136 bool timed_unlock_upgradable_and_lock(const boost::posix_time::ptime &)
137 { return true; }
138
139 //!Simulates try_unlock_sharable_and_lock().
140 //!Equivalent to "return true;"
141 bool try_unlock_sharable_and_lock()
142 { return true; }
143
144 //!Simulates try_unlock_sharable_and_lock_upgradable().
145 //!Equivalent to "return true;"
146 bool try_unlock_sharable_and_lock_upgradable()
147 { return true; }
148 };
149
150 } //namespace interprocess {
151 } //namespace boost {
152
153 #include <boost/interprocess/detail/config_end.hpp>
154
155 #endif //BOOST_INTERPROCESS_NULL_MUTEX_HPP