2 (C) Copyright 2007-11 Anthony Williams
3 (C) Copyright 2011-12 Vicente J. Botet Escriba
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt).
9 [section:mutex_types Mutex Types]
11 [section:mutex Class `mutex`]
13 #include <boost/thread/mutex.hpp>
26 typedef platform-specific-type native_handle_type;
27 native_handle_type native_handle();
29 typedef unique_lock<mutex> scoped_lock;
30 typedef unspecified-type scoped_try_lock;
33 __mutex__ implements the __lockable_concept__ to provide an exclusive-ownership mutex. At most one thread can own the lock on a given
34 instance of __mutex__ at any time. Multiple concurrent calls to __lock_ref__, __try_lock_ref__ and __unlock_ref__ shall be permitted.
36 [section:nativehandle Member function `native_handle()`]
38 typedef platform-specific-type native_handle_type;
39 native_handle_type native_handle();
43 [[Effects:] [Returns an instance of `native_handle_type` that can be used with platform-specific APIs to manipulate the underlying
44 implementation. If no such instance exists, `native_handle()` and `native_handle_type` are not present.]]
46 [[Throws:] [Nothing.]]
55 [section:try_mutex Typedef `try_mutex`]
57 #include <boost/thread/mutex.hpp>
59 typedef mutex try_mutex;
61 __try_mutex__ is a `typedef` to __mutex__, provided for backwards compatibility with previous releases of boost.
65 [section:timed_mutex Class `timed_mutex`]
67 #include <boost/thread/mutex.hpp>
80 template <class Rep, class Period>
81 bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
82 template <class Clock, class Duration>
83 bool try_lock_until(const chrono::time_point<Clock, Duration>& t);
85 typedef platform-specific-type native_handle_type;
86 native_handle_type native_handle();
88 typedef unique_lock<timed_mutex> scoped_timed_lock;
89 typedef unspecified-type scoped_try_lock;
90 typedef scoped_timed_lock scoped_lock;
92 #if defined BOOST_THREAD_PROVIDES_DATE_TIME || defined BOOST_THREAD_DONT_USE_CHRONO
93 bool timed_lock(system_time const & abs_time);
94 template<typename TimeDuration>
95 bool timed_lock(TimeDuration const & relative_time);
100 __timed_mutex__ implements the __timed_lockable_concept__ to provide an exclusive-ownership mutex. At most one thread can own the
101 lock on a given instance of __timed_mutex__ at any time. Multiple concurrent calls to __lock_ref__, __try_lock_ref__,
102 __timed_lock_ref__, __timed_lock_duration_ref__ and __unlock_ref__ shall be permitted.
104 [section:nativehandle Member function `native_handle()`]
106 typedef platform-specific-type native_handle_type;
107 native_handle_type native_handle();
111 [[Effects:] [Returns an instance of `native_handle_type` that can be used with platform-specific APIs to manipulate the underlying
112 implementation. If no such instance exists, `native_handle()` and `native_handle_type` are not present.]]
114 [[Throws:] [Nothing.]]
122 [section:recursive_mutex Class `recursive_mutex`]
124 #include <boost/thread/recursive_mutex.hpp>
126 class recursive_mutex:
134 bool try_lock() noexcept;
137 typedef platform-specific-type native_handle_type;
138 native_handle_type native_handle();
140 typedef unique_lock<recursive_mutex> scoped_lock;
141 typedef unspecified-type scoped_try_lock;
144 __recursive_mutex__ implements the __lockable_concept__ to provide an exclusive-ownership recursive mutex. At most one thread can
145 own the lock on a given instance of __recursive_mutex__ at any time. Multiple concurrent calls to __lock_ref__, __try_lock_ref__ and
146 __unlock_ref__ shall be permitted. A thread that already has exclusive ownership of a given __recursive_mutex__ instance can call
147 __lock_ref__ or __try_lock_ref__ to acquire an additional level of ownership of the mutex. __unlock_ref__ must be called once for
148 each level of ownership acquired by a single thread before ownership can be acquired by another thread.
150 [section:nativehandle Member function `native_handle()`]
152 typedef platform-specific-type native_handle_type;
153 native_handle_type native_handle();
157 [[Effects:] [Returns an instance of `native_handle_type` that can be used with platform-specific APIs to manipulate the underlying
158 implementation. If no such instance exists, `native_handle()` and `native_handle_type` are not present.]]
160 [[Throws:] [Nothing.]]
168 [section:recursive_try_mutex Typedef `recursive_try_mutex`]
170 #include <boost/thread/recursive_mutex.hpp>
172 typedef recursive_mutex recursive_try_mutex;
174 __recursive_try_mutex__ is a `typedef` to __recursive_mutex__, provided for backwards compatibility with previous releases of boost.
178 [section:recursive_timed_mutex Class `recursive_timed_mutex`]
180 #include <boost/thread/recursive_mutex.hpp>
182 class recursive_timed_mutex:
186 recursive_timed_mutex();
187 ~recursive_timed_mutex();
190 bool try_lock() noexcept;
194 template <class Rep, class Period>
195 bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
196 template <class Clock, class Duration>
197 bool try_lock_until(const chrono::time_point<Clock, Duration>& t);
199 typedef platform-specific-type native_handle_type;
200 native_handle_type native_handle();
202 typedef unique_lock<recursive_timed_mutex> scoped_lock;
203 typedef unspecified-type scoped_try_lock;
204 typedef scoped_lock scoped_timed_lock;
206 #if defined BOOST_THREAD_PROVIDES_DATE_TIME || defined BOOST_THREAD_DONT_USE_CHRONO
207 bool timed_lock(system_time const & abs_time);
208 template<typename TimeDuration>
209 bool timed_lock(TimeDuration const & relative_time);
214 __recursive_timed_mutex__ implements the __timed_lockable_concept__ to provide an exclusive-ownership recursive mutex. At most one
215 thread can own the lock on a given instance of __recursive_timed_mutex__ at any time. Multiple concurrent calls to __lock_ref__,
216 __try_lock_ref__, __timed_lock_ref__, __timed_lock_duration_ref__ and __unlock_ref__ shall be permitted. A thread that already has
217 exclusive ownership of a given __recursive_timed_mutex__ instance can call __lock_ref__, __timed_lock_ref__,
218 __timed_lock_duration_ref__ or __try_lock_ref__ to acquire an additional level of ownership of the mutex. __unlock_ref__ must be
219 called once for each level of ownership acquired by a single thread before ownership can be acquired by another thread.
221 [section:nativehandle Member function `native_handle()`]
223 typedef platform-specific-type native_handle_type;
224 native_handle_type native_handle();
228 [[Effects:] [Returns an instance of `native_handle_type` that can be used with platform-specific APIs to manipulate the underlying
229 implementation. If no such instance exists, `native_handle()` and `native_handle_type` are not present.]]
231 [[Throws:] [Nothing.]]
239 [include shared_mutex_ref.qbk]