summaryrefslogtreecommitdiffstats
path: root/libcxxabi/src/fallback_malloc.cpp
diff options
context:
space:
mode:
authorAsiri Rathnayake <asiri.rathnayake@arm.com>2017-01-03 12:58:34 +0000
committerAsiri Rathnayake <asiri.rathnayake@arm.com>2017-01-03 12:58:34 +0000
commit97ba9fae1f536778b1aaff4220512626e6170728 (patch)
treeb571c9be99563d7dd7d8343a904a53f00d1addf9 /libcxxabi/src/fallback_malloc.cpp
parentb44b4cbae8417b2f51ff7316b06326f5ed79929c (diff)
downloadbcm5719-llvm-97ba9fae1f536778b1aaff4220512626e6170728.tar.gz
bcm5719-llvm-97ba9fae1f536778b1aaff4220512626e6170728.zip
[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 llvm-svn: 290888
Diffstat (limited to 'libcxxabi/src/fallback_malloc.cpp')
-rw-r--r--libcxxabi/src/fallback_malloc.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/libcxxabi/src/fallback_malloc.cpp b/libcxxabi/src/fallback_malloc.cpp
index 5f52ece56f4..3f8441e1882 100644
--- a/libcxxabi/src/fallback_malloc.cpp
+++ b/libcxxabi/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;
OpenPOWER on IntegriCloud