These functions can all be noexcept (if we ever wanted to check the
mutex is owned by the calling thread in the adopt_lock ctors we'd
abort, not throw).
* include/bits/std_mutex.h (mutex::native_handle)
(lock_guard(mutex_type&, adopt_lock_t)
(unique_lock(mutex_type&, adopt_lock_t): Add noexcept.
* include/std/mutex (recursive_mutex, timed_mutex)
(recursive_timed_mutex): Likewise.
Tested powerpc64le-linux, committed to trunk.
commit 65e13b82ae0dac570b2e558d302bffa791d94375
Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue Oct 11 10:33:16 2016 +0000
More noexcept for standard mutex types and locks
* include/bits/std_mutex.h (mutex::native_handle)
(lock_guard(mutex_type&, adopt_lock_t)
(unique_lock(mutex_type&, adopt_lock_t): Add noexcept.
* include/std/mutex (recursive_mutex, timed_mutex)
(recursive_timed_mutex): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240980
138bc75d-0d04-0410-961f-82ee72b054a4
diff --git a/libstdc++-v3/include/bits/std_mutex.h
b/libstdc++-v3/include/bits/std_mutex.h
index 49ef752..ad43841 100644
--- a/libstdc++-v3/include/bits/std_mutex.h
+++ b/libstdc++-v3/include/bits/std_mutex.h
@@ -122,7 +122,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
native_handle_type
- native_handle()
+ native_handle() noexcept
{ return &_M_mutex; }
};
@@ -161,7 +161,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
explicit lock_guard(mutex_type& __m) : _M_device(__m)
{ _M_device.lock(); }
- lock_guard(mutex_type& __m, adopt_lock_t) : _M_device(__m)
+ lock_guard(mutex_type& __m, adopt_lock_t) noexcept : _M_device(__m)
{ } // calling thread owns mutex
~lock_guard()
@@ -206,7 +206,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: _M_device(std::__addressof(__m)), _M_owns(_M_device->try_lock())
{ }
- unique_lock(mutex_type& __m, adopt_lock_t)
+ unique_lock(mutex_type& __m, adopt_lock_t) noexcept
: _M_device(std::__addressof(__m)), _M_owns(true)
{
// XXX calling thread owns mutex
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index 1f4da57..7a7bd2e 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -124,7 +124,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
native_handle_type
- native_handle()
+ native_handle() noexcept
{ return &_M_mutex; }
};
@@ -219,7 +219,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
native_handle_type
- native_handle()
+ native_handle() noexcept
{ return &_M_mutex; }
private:
@@ -279,7 +279,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
native_handle_type
- native_handle()
+ native_handle() noexcept
{ return &_M_mutex; }
private: