diff options
Diffstat (limited to 'contrib/libc++/src/mutex.cpp')
-rw-r--r-- | contrib/libc++/src/mutex.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/contrib/libc++/src/mutex.cpp b/contrib/libc++/src/mutex.cpp index 9f808ca..9397ae7 100644 --- a/contrib/libc++/src/mutex.cpp +++ b/contrib/libc++/src/mutex.cpp @@ -59,7 +59,7 @@ recursive_mutex::recursive_mutex() recursive_mutex::~recursive_mutex() { - int e = __libcpp_mutex_destroy(&__m_); + int e = __libcpp_recursive_mutex_destroy(&__m_); (void)e; assert(e == 0); } @@ -67,7 +67,7 @@ recursive_mutex::~recursive_mutex() void recursive_mutex::lock() { - int ec = __libcpp_mutex_lock(&__m_); + int ec = __libcpp_recursive_mutex_lock(&__m_); if (ec) __throw_system_error(ec, "recursive_mutex lock failed"); } @@ -75,7 +75,7 @@ recursive_mutex::lock() void recursive_mutex::unlock() _NOEXCEPT { - int e = __libcpp_mutex_unlock(&__m_); + int e = __libcpp_recursive_mutex_unlock(&__m_); (void)e; assert(e == 0); } @@ -83,7 +83,7 @@ recursive_mutex::unlock() _NOEXCEPT bool recursive_mutex::try_lock() _NOEXCEPT { - return __libcpp_mutex_trylock(&__m_) == 0; + return __libcpp_recursive_mutex_trylock(&__m_) == 0; } // timed_mutex @@ -195,13 +195,10 @@ recursive_timed_mutex::unlock() _NOEXCEPT // keep in sync with: 7741191. #ifndef _LIBCPP_HAS_NO_THREADS -static __libcpp_mutex_t mut = _LIBCPP_MUTEX_INITIALIZER; -static __libcpp_condvar_t cv = _LIBCPP_CONDVAR_INITIALIZER; +_LIBCPP_SAFE_STATIC static __libcpp_mutex_t mut = _LIBCPP_MUTEX_INITIALIZER; +_LIBCPP_SAFE_STATIC static __libcpp_condvar_t cv = _LIBCPP_CONDVAR_INITIALIZER; #endif -/// NOTE: Changes to flag are done via relaxed atomic stores -/// even though the accesses are protected by a mutex because threads -/// just entering 'call_once` concurrently read from flag. void __call_once(volatile unsigned long& flag, void* arg, void(*func)(void*)) { @@ -238,7 +235,7 @@ __call_once(volatile unsigned long& flag, void* arg, void(*func)(void*)) __libcpp_mutex_unlock(&mut); func(arg); __libcpp_mutex_lock(&mut); - __libcpp_relaxed_store(&flag, ~0ul); + __libcpp_atomic_store(&flag, ~0ul, _AO_Release); __libcpp_mutex_unlock(&mut); __libcpp_condvar_broadcast(&cv); #ifndef _LIBCPP_NO_EXCEPTIONS |