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@16
|
14 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
|
Chris@16
|
15 # pragma once
|
Chris@16
|
16 #endif
|
Chris@16
|
17
|
Chris@16
|
18 #include <boost/interprocess/detail/config_begin.hpp>
|
Chris@16
|
19 #include <boost/interprocess/detail/workaround.hpp>
|
Chris@16
|
20
|
Chris@16
|
21
|
Chris@16
|
22 //!\file
|
Chris@16
|
23 //!Describes null_mutex classes
|
Chris@16
|
24
|
Chris@16
|
25 namespace boost {
|
Chris@16
|
26
|
Chris@16
|
27 namespace posix_time
|
Chris@16
|
28 { class ptime; }
|
Chris@16
|
29
|
Chris@16
|
30 namespace interprocess {
|
Chris@16
|
31
|
Chris@16
|
32 //!Implements a mutex that simulates a mutex without doing any operation and
|
Chris@16
|
33 //!simulates a successful operation.
|
Chris@16
|
34 class null_mutex
|
Chris@16
|
35 {
|
Chris@16
|
36 /// @cond
|
Chris@16
|
37 null_mutex(const null_mutex&);
|
Chris@16
|
38 null_mutex &operator= (const null_mutex&);
|
Chris@16
|
39 /// @endcond
|
Chris@16
|
40 public:
|
Chris@16
|
41
|
Chris@16
|
42 //!Constructor.
|
Chris@16
|
43 //!Empty.
|
Chris@16
|
44 null_mutex(){}
|
Chris@16
|
45
|
Chris@16
|
46 //!Destructor.
|
Chris@16
|
47 //!Empty.
|
Chris@16
|
48 ~null_mutex(){}
|
Chris@16
|
49
|
Chris@16
|
50 //!Simulates a mutex lock() operation. Empty function.
|
Chris@16
|
51 void lock(){}
|
Chris@16
|
52
|
Chris@16
|
53 //!Simulates a mutex try_lock() operation.
|
Chris@16
|
54 //!Equivalent to "return true;"
|
Chris@16
|
55 bool try_lock()
|
Chris@16
|
56 { return true; }
|
Chris@16
|
57
|
Chris@16
|
58 //!Simulates a mutex timed_lock() operation.
|
Chris@16
|
59 //!Equivalent to "return true;"
|
Chris@16
|
60 bool timed_lock(const boost::posix_time::ptime &)
|
Chris@16
|
61 { return true; }
|
Chris@16
|
62
|
Chris@16
|
63 //!Simulates a mutex unlock() operation.
|
Chris@16
|
64 //!Empty function.
|
Chris@16
|
65 void unlock(){}
|
Chris@16
|
66
|
Chris@16
|
67 //!Simulates a mutex lock_sharable() operation.
|
Chris@16
|
68 //!Empty function.
|
Chris@16
|
69 void lock_sharable(){}
|
Chris@16
|
70
|
Chris@16
|
71 //!Simulates a mutex try_lock_sharable() operation.
|
Chris@16
|
72 //!Equivalent to "return true;"
|
Chris@16
|
73 bool try_lock_sharable()
|
Chris@16
|
74 { return true; }
|
Chris@16
|
75
|
Chris@16
|
76 //!Simulates a mutex timed_lock_sharable() operation.
|
Chris@16
|
77 //!Equivalent to "return true;"
|
Chris@16
|
78 bool timed_lock_sharable(const boost::posix_time::ptime &)
|
Chris@16
|
79 { return true; }
|
Chris@16
|
80
|
Chris@16
|
81 //!Simulates a mutex unlock_sharable() operation.
|
Chris@16
|
82 //!Empty function.
|
Chris@16
|
83 void unlock_sharable(){}
|
Chris@16
|
84
|
Chris@16
|
85 //!Simulates a mutex lock_upgradable() operation.
|
Chris@16
|
86 //!Empty function.
|
Chris@16
|
87 void lock_upgradable(){}
|
Chris@16
|
88
|
Chris@16
|
89 //!Simulates a mutex try_lock_upgradable() operation.
|
Chris@16
|
90 //!Equivalent to "return true;"
|
Chris@16
|
91 bool try_lock_upgradable()
|
Chris@16
|
92 { return true; }
|
Chris@16
|
93
|
Chris@16
|
94 //!Simulates a mutex timed_lock_upgradable() operation.
|
Chris@16
|
95 //!Equivalent to "return true;"
|
Chris@16
|
96 bool timed_lock_upgradable(const boost::posix_time::ptime &)
|
Chris@16
|
97 { return true; }
|
Chris@16
|
98
|
Chris@16
|
99 //!Simulates a mutex unlock_upgradable() operation.
|
Chris@16
|
100 //!Empty function.
|
Chris@16
|
101 void unlock_upgradable(){}
|
Chris@16
|
102
|
Chris@16
|
103 //!Simulates unlock_and_lock_upgradable().
|
Chris@16
|
104 //!Empty function.
|
Chris@16
|
105 void unlock_and_lock_upgradable(){}
|
Chris@16
|
106
|
Chris@16
|
107 //!Simulates unlock_and_lock_sharable().
|
Chris@16
|
108 //!Empty function.
|
Chris@16
|
109 void unlock_and_lock_sharable(){}
|
Chris@16
|
110
|
Chris@16
|
111 //!Simulates unlock_upgradable_and_lock_sharable().
|
Chris@16
|
112 //!Empty function.
|
Chris@16
|
113 void unlock_upgradable_and_lock_sharable(){}
|
Chris@16
|
114
|
Chris@16
|
115 //Promotions
|
Chris@16
|
116
|
Chris@16
|
117 //!Simulates unlock_upgradable_and_lock().
|
Chris@16
|
118 //!Empty function.
|
Chris@16
|
119 void unlock_upgradable_and_lock(){}
|
Chris@16
|
120
|
Chris@16
|
121 //!Simulates try_unlock_upgradable_and_lock().
|
Chris@16
|
122 //!Equivalent to "return true;"
|
Chris@16
|
123 bool try_unlock_upgradable_and_lock()
|
Chris@16
|
124 { return true; }
|
Chris@16
|
125
|
Chris@16
|
126 //!Simulates timed_unlock_upgradable_and_lock().
|
Chris@16
|
127 //!Equivalent to "return true;"
|
Chris@16
|
128 bool timed_unlock_upgradable_and_lock(const boost::posix_time::ptime &)
|
Chris@16
|
129 { return true; }
|
Chris@16
|
130
|
Chris@16
|
131 //!Simulates try_unlock_sharable_and_lock().
|
Chris@16
|
132 //!Equivalent to "return true;"
|
Chris@16
|
133 bool try_unlock_sharable_and_lock()
|
Chris@16
|
134 { return true; }
|
Chris@16
|
135
|
Chris@16
|
136 //!Simulates try_unlock_sharable_and_lock_upgradable().
|
Chris@16
|
137 //!Equivalent to "return true;"
|
Chris@16
|
138 bool try_unlock_sharable_and_lock_upgradable()
|
Chris@16
|
139 { return true; }
|
Chris@16
|
140 };
|
Chris@16
|
141
|
Chris@16
|
142 } //namespace interprocess {
|
Chris@16
|
143 } //namespace boost {
|
Chris@16
|
144
|
Chris@16
|
145 #include <boost/interprocess/detail/config_end.hpp>
|
Chris@16
|
146
|
Chris@16
|
147 #endif //BOOST_INTERPROCESS_NULL_MUTEX_HPP
|