diff options
Diffstat (limited to 'src/mutex.cpp')
-rw-r--r-- | src/mutex.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/mutex.cpp b/src/mutex.cpp index 9aa051be37f2..42195aa80648 100644 --- a/src/mutex.cpp +++ b/src/mutex.cpp @@ -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) |