noexcept and constexpr applied to <mutex>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160604 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define _LIBCPP_BUILDING_MUTEX
|
||||
#include "mutex"
|
||||
#include "limits"
|
||||
#include "system_error"
|
||||
@@ -32,13 +33,13 @@ mutex::lock()
|
||||
}
|
||||
|
||||
bool
|
||||
mutex::try_lock()
|
||||
mutex::try_lock() _NOEXCEPT
|
||||
{
|
||||
return pthread_mutex_trylock(&__m_) == 0;
|
||||
}
|
||||
|
||||
void
|
||||
mutex::unlock()
|
||||
mutex::unlock() _NOEXCEPT
|
||||
{
|
||||
int ec = pthread_mutex_unlock(&__m_);
|
||||
assert(ec == 0);
|
||||
@@ -90,14 +91,14 @@ recursive_mutex::lock()
|
||||
}
|
||||
|
||||
void
|
||||
recursive_mutex::unlock()
|
||||
recursive_mutex::unlock() _NOEXCEPT
|
||||
{
|
||||
int e = pthread_mutex_unlock(&__m_);
|
||||
assert(e == 0);
|
||||
}
|
||||
|
||||
bool
|
||||
recursive_mutex::try_lock()
|
||||
recursive_mutex::try_lock() _NOEXCEPT
|
||||
{
|
||||
return pthread_mutex_trylock(&__m_) == 0;
|
||||
}
|
||||
@@ -124,7 +125,7 @@ timed_mutex::lock()
|
||||
}
|
||||
|
||||
bool
|
||||
timed_mutex::try_lock()
|
||||
timed_mutex::try_lock() _NOEXCEPT
|
||||
{
|
||||
unique_lock<mutex> lk(__m_, try_to_lock);
|
||||
if (lk.owns_lock() && !__locked_)
|
||||
@@ -136,7 +137,7 @@ timed_mutex::try_lock()
|
||||
}
|
||||
|
||||
void
|
||||
timed_mutex::unlock()
|
||||
timed_mutex::unlock() _NOEXCEPT
|
||||
{
|
||||
lock_guard<mutex> _(__m_);
|
||||
__locked_ = false;
|
||||
@@ -175,7 +176,7 @@ recursive_timed_mutex::lock()
|
||||
}
|
||||
|
||||
bool
|
||||
recursive_timed_mutex::try_lock()
|
||||
recursive_timed_mutex::try_lock() _NOEXCEPT
|
||||
{
|
||||
pthread_t id = pthread_self();
|
||||
unique_lock<mutex> lk(__m_, try_to_lock);
|
||||
@@ -191,7 +192,7 @@ recursive_timed_mutex::try_lock()
|
||||
}
|
||||
|
||||
void
|
||||
recursive_timed_mutex::unlock()
|
||||
recursive_timed_mutex::unlock() _NOEXCEPT
|
||||
{
|
||||
unique_lock<mutex> lk(__m_);
|
||||
if (--__count_ == 0)
|
||||
|
Reference in New Issue
Block a user