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