1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Vicente J. Botet Escriba 2008-2009,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)
7 // See http://www.boost.org/libs/thread for documentation.
9 //////////////////////////////////////////////////////////////////////////////
11 #ifndef BOOST_THREAD_NULL_MUTEX_HPP
12 #define BOOST_THREAD_NULL_MUTEX_HPP
14 #include <boost/thread/detail/config.hpp>
15 #include <boost/thread/detail/delete.hpp>
16 #include <boost/chrono/chrono.hpp>
19 /// Describes null_mutex class
24 /// Implements a mutex that simulates a mutex without doing any operation and
25 /// simulates a successful operation.
30 BOOST_THREAD_NO_COPYABLE( null_mutex) /*< no copyable >*/
34 /// Simulates a mutex lock() operation. Empty function.
39 /// Simulates a mutex try_lock() operation.
40 /// Equivalent to "return true;"
46 /// Simulates a mutex unlock() operation.
52 #ifdef BOOST_THREAD_USES_CHRONO
53 /// Simulates a mutex try_lock_until() operation.
54 /// Equivalent to "return true;"
55 template <typename Clock, typename Duration>
56 bool try_lock_until(chrono::time_point<Clock, Duration> const &)
61 /// Simulates a mutex try_lock_for() operation.
62 /// Equivalent to "return true;"
63 template <typename Rep, typename Period>
64 bool try_lock_for(chrono::duration<Rep, Period> const &)
70 /// Simulates a mutex lock_shared() operation.
76 /// Simulates a mutex try_lock_shared() operation.
77 /// Equivalent to "return true;"
78 bool try_lock_shared()
83 /// Simulates a mutex unlock_shared() operation.
89 /// Simulates a mutex try_lock_shared_until() operation.
90 /// Equivalent to "return true;"
91 template <typename Clock, typename Duration>
92 bool try_lock_shared_until(chrono::time_point<Clock, Duration> const &)
96 /// Simulates a mutex try_lock_shared_for() operation.
97 /// Equivalent to "return true;"
98 template <typename Rep, typename Period>
99 bool try_lock_shared_for(chrono::duration<Rep, Period> const &)
104 /// Simulates a mutex lock_upgrade() operation.
110 /// Simulates a mutex try_lock_upgrade() operation.
111 /// Equivalent to "return true;"
112 bool try_lock_upgrade()
117 /// Simulates a mutex unlock_upgrade() operation.
119 void unlock_upgrade()
123 /// Simulates a mutex try_lock_upgrade_until() operation.
124 /// Equivalent to "return true;"
125 template <typename Clock, typename Duration>
126 bool try_lock_upgrade_until(chrono::time_point<Clock, Duration> const &)
131 /// Simulates a mutex try_lock_upgrade_for() operation.
132 /// Equivalent to "return true;"
133 template <typename Rep, typename Period>
134 bool try_lock_upgrade_for(chrono::duration<Rep, Period> const &)
139 /// Simulates a mutex try_unlock_shared_and_lock() operation.
140 /// Equivalent to "return true;"
141 bool try_unlock_shared_and_lock()
146 #ifdef BOOST_THREAD_USES_CHRONO
147 /// Simulates a mutex try_unlock_shared_and_lock_until() operation.
148 /// Equivalent to "return true;"
149 template <typename Clock, typename Duration>
150 bool try_unlock_shared_and_lock_until(chrono::time_point<Clock, Duration> const &)
155 /// Simulates a mutex try_unlock_shared_and_lock_for() operation.
156 /// Equivalent to "return true;"
157 template <typename Rep, typename Period>
158 bool try_unlock_shared_and_lock_for(chrono::duration<Rep, Period> const &)
164 /// Simulates unlock_and_lock_shared().
166 void unlock_and_lock_shared()
170 /// Simulates a mutex try_unlock_shared_and_lock_upgrade() operation.
171 /// Equivalent to "return true;"
172 bool try_unlock_shared_and_lock_upgrade()
177 #ifdef BOOST_THREAD_USES_CHRONO
178 /// Simulates a mutex try_unlock_shared_and_lock_upgrade_until() operation.
179 /// Equivalent to "return true;"
180 template <typename Clock, typename Duration>
181 bool try_unlock_shared_and_lock_upgrade_until(chrono::time_point<Clock, Duration> const &)
186 /// Simulates a mutex try_unlock_shared_and_lock_upgrade_for() operation.
187 /// Equivalent to "return true;"
188 template <typename Rep, typename Period>
189 bool try_unlock_shared_and_lock_upgrade_for(chrono::duration<Rep, Period> const &)
195 /// Simulates unlock_and_lock_upgrade().
197 void unlock_and_lock_upgrade()
201 /// Simulates unlock_upgrade_and_lock().
203 void unlock_upgrade_and_lock()
207 /// Simulates a mutex try_unlock_upgrade_and_lock() operation.
208 /// Equivalent to "return true;"
209 bool try_unlock_upgrade_and_lock()
214 #ifdef BOOST_THREAD_USES_CHRONO
215 /// Simulates a mutex try_unlock_upgrade_and_lock_until() operation.
216 /// Equivalent to "return true;"
217 template <typename Clock, typename Duration>
218 bool try_unlock_upgrade_and_lock_until(chrono::time_point<Clock, Duration> const &)
223 /// Simulates a mutex try_unlock_upgrade_and_lock_for() operation.
224 /// Equivalent to "return true;"
225 template <typename Rep, typename Period>
226 bool try_unlock_upgrade_and_lock_for(chrono::duration<Rep, Period> const &)
232 /// Simulates unlock_upgrade_and_lock_shared().
234 void unlock_upgrade_and_lock_shared()
240 } //namespace boost {