30 #ifndef _GLIBCXX_UNIQUE_LOCK_H
31 #define _GLIBCXX_UNIQUE_LOCK_H 1
33 #pragma GCC system_header
35 #if __cplusplus < 201103L
42 namespace std _GLIBCXX_VISIBILITY(default)
44 _GLIBCXX_BEGIN_NAMESPACE_VERSION
55 template<
typename _Mutex>
59 typedef _Mutex mutex_type;
62 : _M_device(0), _M_owns(
false)
86 template<
typename _Clock,
typename _Duration>
90 _M_owns(_M_device->try_lock_until(__atime))
93 template<
typename _Rep,
typename _Period>
97 _M_owns(_M_device->try_lock_for(__rtime))
110 : _M_device(__u._M_device), _M_owns(__u._M_owns)
133 __throw_system_error(
int(errc::operation_not_permitted));
135 __throw_system_error(
int(errc::resource_deadlock_would_occur));
147 __throw_system_error(
int(errc::operation_not_permitted));
149 __throw_system_error(
int(errc::resource_deadlock_would_occur));
152 _M_owns = _M_device->try_lock();
157 template<
typename _Clock,
typename _Duration>
162 __throw_system_error(
int(errc::operation_not_permitted));
164 __throw_system_error(
int(errc::resource_deadlock_would_occur));
167 _M_owns = _M_device->try_lock_until(__atime);
172 template<
typename _Rep,
typename _Period>
177 __throw_system_error(
int(errc::operation_not_permitted));
179 __throw_system_error(
int(errc::resource_deadlock_would_occur));
182 _M_owns = _M_device->try_lock_for(__rtime);
191 __throw_system_error(
int(errc::operation_not_permitted));
202 std::swap(_M_device, __u._M_device);
203 std::swap(_M_owns, __u._M_owns);
209 mutex_type* __ret = _M_device;
216 owns_lock()
const noexcept
219 explicit operator bool()
const noexcept
220 {
return owns_lock(); }
223 mutex()
const noexcept
224 {
return _M_device; }
227 mutex_type* _M_device;
233 template<
typename _Mutex>
238 _GLIBCXX_END_NAMESPACE_VERSION
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
ISO C++ entities toplevel namespace is std.
Do not acquire ownership of the mutex.
Try to acquire ownership of the mutex without blocking.
Assume the calling thread has already obtained mutex ownership and manage it.
A movable scoped lock type.
void swap(unique_lock< _Mutex > &__x, unique_lock< _Mutex > &__y) noexcept
Swap overload for unique_lock objects.