thread_support: split out {,non-}recursive mutex

Split out the recursive and non-recursive mutex.  This split is needed
for platforms which may use differing types for the two mutex (e.g.
Win32 threads).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291145 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Saleem Abdulrasool
2017-01-05 17:54:45 +00:00
parent dceaa0e352
commit 3451a65e1b
3 changed files with 43 additions and 8 deletions

View File

@@ -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