diff options
Diffstat (limited to 'libcxx/src/mutex.cpp')
| -rw-r--r-- | libcxx/src/mutex.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/libcxx/src/mutex.cpp b/libcxx/src/mutex.cpp index 01b7420fa3b8..b3b84c4dc430 100644 --- a/libcxx/src/mutex.cpp +++ b/libcxx/src/mutex.cpp @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include <__assert> +#include <__thread/id.h> #include <limits> #include <mutex> -#include <system_error> #include "include/atomic_support.h" @@ -26,10 +26,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_HAS_NO_THREADS -const defer_lock_t defer_lock{}; -const try_to_lock_t try_to_lock{}; -const adopt_lock_t adopt_lock{}; - // ~mutex is defined elsewhere void @@ -51,7 +47,7 @@ mutex::unlock() noexcept { int ec = __libcpp_mutex_unlock(&__m_); (void)ec; - _LIBCPP_ASSERT(ec == 0, "call to mutex::unlock failed"); + _LIBCPP_ASSERT_UNCATEGORIZED(ec == 0, "call to mutex::unlock failed"); } // recursive_mutex @@ -67,7 +63,7 @@ recursive_mutex::~recursive_mutex() { int e = __libcpp_recursive_mutex_destroy(&__m_); (void)e; - _LIBCPP_ASSERT(e == 0, "call to ~recursive_mutex() failed"); + _LIBCPP_ASSERT_UNCATEGORIZED(e == 0, "call to ~recursive_mutex() failed"); } void @@ -83,7 +79,7 @@ recursive_mutex::unlock() noexcept { int e = __libcpp_recursive_mutex_unlock(&__m_); (void)e; - _LIBCPP_ASSERT(e == 0, "call to recursive_mutex::unlock() failed"); + _LIBCPP_ASSERT_UNCATEGORIZED(e == 0, "call to recursive_mutex::unlock() failed"); } bool @@ -211,21 +207,21 @@ void __call_once(volatile once_flag::_State_type& flag, void* arg, #if defined(_LIBCPP_HAS_NO_THREADS) if (flag == 0) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS flag = 1; func(arg); flag = ~once_flag::_State_type(0); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { flag = 0; throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } #else // !_LIBCPP_HAS_NO_THREADS __libcpp_mutex_lock(&mut); @@ -233,10 +229,10 @@ void __call_once(volatile once_flag::_State_type& flag, void* arg, __libcpp_condvar_wait(&cv, &mut); if (flag == 0) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __libcpp_relaxed_store(&flag, once_flag::_State_type(1)); __libcpp_mutex_unlock(&mut); func(arg); @@ -245,7 +241,7 @@ void __call_once(volatile once_flag::_State_type& flag, void* arg, _AO_Release); __libcpp_mutex_unlock(&mut); __libcpp_condvar_broadcast(&cv); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -255,7 +251,7 @@ void __call_once(volatile once_flag::_State_type& flag, void* arg, __libcpp_condvar_broadcast(&cv); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } else __libcpp_mutex_unlock(&mut); |
