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
58 template<
typename _Mutex>
62 typedef _Mutex mutex_type;
65 : _M_device(0), _M_owns(
false)
89 template<
typename _Clock,
typename _Duration>
93 _M_owns(_M_device->try_lock_until(__atime))
96 template<
typename _Rep,
typename _Period>
100 _M_owns(_M_device->try_lock_for(__rtime))
113 : _M_device(__u._M_device), _M_owns(__u._M_owns)
136 __throw_system_error(
int(errc::operation_not_permitted));
138 __throw_system_error(
int(errc::resource_deadlock_would_occur));
151 __throw_system_error(
int(errc::operation_not_permitted));
153 __throw_system_error(
int(errc::resource_deadlock_would_occur));
156 _M_owns = _M_device->try_lock();
161 template<
typename _Clock,
typename _Duration>
167 __throw_system_error(
int(errc::operation_not_permitted));
169 __throw_system_error(
int(errc::resource_deadlock_would_occur));
172 _M_owns = _M_device->try_lock_until(__atime);
177 template<
typename _Rep,
typename _Period>
183 __throw_system_error(
int(errc::operation_not_permitted));
185 __throw_system_error(
int(errc::resource_deadlock_would_occur));
188 _M_owns = _M_device->try_lock_for(__rtime);
197 __throw_system_error(
int(errc::operation_not_permitted));
208 std::swap(_M_device, __u._M_device);
209 std::swap(_M_owns, __u._M_owns);
215 mutex_type* __ret = _M_device;
223 owns_lock()
const noexcept
226 explicit operator bool()
const noexcept
227 {
return owns_lock(); }
231 mutex()
const noexcept
232 {
return _M_device; }
235 mutex_type* _M_device;
241 template<
typename _Mutex>
246 _GLIBCXX_END_NAMESPACE_VERSION
250 #endif // _GLIBCXX_UNIQUE_LOCK_H