diff options
author | Jonathan Roelofs <jonathan@codesourcery.com> | 2014-09-05 19:45:05 +0000 |
---|---|---|
committer | Jonathan Roelofs <jonathan@codesourcery.com> | 2014-09-05 19:45:05 +0000 |
commit | b3fcc67f8f13cd95d36ed29d0ae1308decb9e099 (patch) | |
tree | 0c01716be284ed8200fde073b145887bea7b4508 /libcxx/src/algorithm.cpp | |
parent | d3e121331bafa274b654bf2e1691cde628b7ff55 (diff) | |
download | bcm5719-llvm-b3fcc67f8f13cd95d36ed29d0ae1308decb9e099.tar.gz bcm5719-llvm-b3fcc67f8f13cd95d36ed29d0ae1308decb9e099.zip |
Allow libc++ to be built on systems without POSIX threads
If you're crazy enough to want this sort of thing, then add
-D_LIBCPP_HAS_NO_THREADS to your CXXFLAGS and
--param=additiona_features=libcpp-has-no-threads to your lit commnad line.
http://reviews.llvm.org/D3969
llvm-svn: 217271
Diffstat (limited to 'libcxx/src/algorithm.cpp')
-rw-r--r-- | libcxx/src/algorithm.cpp | 8 |
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 |