summaryrefslogtreecommitdiffstats
path: root/libcxx/src/algorithm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/src/algorithm.cpp')
-rw-r--r--libcxx/src/algorithm.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libcxx/src/algorithm.cpp b/libcxx/src/algorithm.cpp
index 6d5cf7c0bc8..e548856ff6e 100644
--- a/libcxx/src/algorithm.cpp
+++ b/libcxx/src/algorithm.cpp
@@ -47,12 +47,16 @@ template bool __insertion_sort_incomplete<__less<long double>&, long double*>(lo
template unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&);
+#ifndef _LIBCPP_HAS_NO_THREADS
static pthread_mutex_t __rs_mut = PTHREAD_MUTEX_INITIALIZER;
+#endif
unsigned __rs_default::__c_ = 0;
__rs_default::__rs_default()
{
+#ifndef _LIBCPP_HAS_NO_THREADS
pthread_mutex_lock(&__rs_mut);
+#endif
__c_ = 1;
}
@@ -63,8 +67,12 @@ __rs_default::__rs_default(const __rs_default&)
__rs_default::~__rs_default()
{
+#ifndef _LIBCPP_HAS_NO_THREADS
if (--__c_ == 0)
pthread_mutex_unlock(&__rs_mut);
+#else
+ --__c_;
+#endif
}
__rs_default::result_type
OpenPOWER on IntegriCloud