diff options
author | Asiri Rathnayake <asiri.rathnayake@arm.com> | 2017-01-03 12:58:34 +0000 |
---|---|---|
committer | Asiri Rathnayake <asiri.rathnayake@arm.com> | 2017-01-03 12:58:34 +0000 |
commit | 71ba2871943cec379da0585c16f69fb5ac5a884b (patch) | |
tree | 88f9cd591439d08f6e4d767409652e66cff99ec4 /src/fallback_malloc.cpp | |
parent | cb51028de0ef63c71ec97f51f8858ef6b972cba2 (diff) |
[libcxxabi] Introduce an externally threaded libc++abi variant.
r281179 Introduced an externally threaded variant of the libc++ library. This
patch adds support for a similar library variant for libc++abi.
Differential revision: https://reviews.llvm.org/D27575
Reviewers: EricWF
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@290888 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'src/fallback_malloc.cpp')
-rw-r--r-- | src/fallback_malloc.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/fallback_malloc.cpp b/src/fallback_malloc.cpp index 5f52ece..3f8441e 100644 --- a/src/fallback_malloc.cpp +++ b/src/fallback_malloc.cpp @@ -10,7 +10,7 @@ #include "fallback_malloc.h" #include "config.h" -#include "threading_support.h" +#include <__threading_support> #include <cstdlib> // for malloc, calloc, free #include <cstring> // for memset @@ -29,7 +29,8 @@ namespace { // When POSIX threads are not available, make the mutex operations a nop #ifndef _LIBCXXABI_HAS_NO_THREADS -static __libcxxabi_mutex_t heap_mutex = _LIBCXXABI_MUTEX_INITIALIZER; +_LIBCPP_SAFE_STATIC +static std::__libcpp_mutex_t heap_mutex = _LIBCPP_MUTEX_INITIALIZER; #else static void * heap_mutex = 0; #endif @@ -37,8 +38,10 @@ static void * heap_mutex = 0; class mutexor { public: #ifndef _LIBCXXABI_HAS_NO_THREADS - mutexor ( __libcxxabi_mutex_t *m ) : mtx_(m) { __libcxxabi_mutex_lock ( mtx_ ); } - ~mutexor () { __libcxxabi_mutex_unlock ( mtx_ ); } + mutexor ( std::__libcpp_mutex_t *m ) : mtx_(m) { + std::__libcpp_mutex_lock ( mtx_ ); + } + ~mutexor () { std::__libcpp_mutex_unlock ( mtx_ ); } #else mutexor ( void * ) {} ~mutexor () {} @@ -47,9 +50,9 @@ private: mutexor ( const mutexor &rhs ); mutexor & operator = ( const mutexor &rhs ); #ifndef _LIBCXXABI_HAS_NO_THREADS - __libcxxabi_mutex_t *mtx_; + std::__libcpp_mutex_t *mtx_; #endif - }; +}; static const size_t HEAP_SIZE = 512; |