30 #ifndef _GLIBCXX_UNIQUE_LOCK_H
31 #define _GLIBCXX_UNIQUE_LOCK_H 1
33 #pragma GCC system_header
35 #if __cplusplus < 201103L
43 namespace std _GLIBCXX_VISIBILITY(default)
45 _GLIBCXX_BEGIN_NAMESPACE_VERSION
56 template<
typename _Mutex>
60 typedef _Mutex mutex_type;
63 : _M_device(0), _M_owns(
false)
87 template<
typename _Clock,
typename _Duration>
91 _M_owns(_M_device->try_lock_until(__atime))
94 template<
typename _Rep,
typename _Period>
98 _M_owns(_M_device->try_lock_for(__rtime))
111 : _M_device(__u._M_device), _M_owns(__u._M_owns)
134 __throw_system_error(
int(errc::operation_not_permitted));
136 __throw_system_error(
int(errc::resource_deadlock_would_occur));
148 __throw_system_error(
int(errc::operation_not_permitted));
150 __throw_system_error(
int(errc::resource_deadlock_would_occur));
153 _M_owns = _M_device->try_lock();
158 template<
typename _Clock,
typename _Duration>
163 __throw_system_error(
int(errc::operation_not_permitted));
165 __throw_system_error(
int(errc::resource_deadlock_would_occur));
168 _M_owns = _M_device->try_lock_until(__atime);
173 template<
typename _Rep,
typename _Period>
178 __throw_system_error(
int(errc::operation_not_permitted));
180 __throw_system_error(
int(errc::resource_deadlock_would_occur));
183 _M_owns = _M_device->try_lock_for(__rtime);
192 __throw_system_error(
int(errc::operation_not_permitted));
210 mutex_type* __ret = _M_device;
217 owns_lock()
const noexcept
220 explicit operator bool()
const noexcept
221 {
return owns_lock(); }
224 mutex()
const noexcept
225 {
return _M_device; }
228 mutex_type* _M_device;
234 template<
typename _Mutex>
239 _GLIBCXX_END_NAMESPACE_VERSION
243 #endif // _GLIBCXX_UNIQUE_LOCK_H