On single threaded systems, turn mutexes into nops

http://reviews.llvm.org/D3386

llvm-svn: 208135
diff --git a/libcxxabi/src/fallback_malloc.ipp b/libcxxabi/src/fallback_malloc.ipp
index 4f8ce90..a97f3fd 100644
--- a/libcxxabi/src/fallback_malloc.ipp
+++ b/libcxxabi/src/fallback_malloc.ipp
@@ -11,6 +11,8 @@
 //  
 //===----------------------------------------------------------------------===//
 
+#include "config.h"
+
 //  A small, simple heap manager based (loosely) on 
 //  the startup heap manager from FreeBSD, optimized for space.
 //
@@ -23,16 +25,28 @@
 
 namespace {
 
+// When POSIX threads are not available, make the mutex operations a nop
+#if LIBCXXABI_SINGLE_THREADED
+static void * heap_mutex = 0;
+#else
 static pthread_mutex_t heap_mutex = PTHREAD_MUTEX_INITIALIZER;
+#endif
 
 class mutexor {
 public:
+#if LIBCXXABI_SINGLE_THREADED
+    mutexor ( void * ) {}
+    ~mutexor () {}
+#else
     mutexor ( pthread_mutex_t *m ) : mtx_(m) { pthread_mutex_lock ( mtx_ ); }
     ~mutexor () { pthread_mutex_unlock ( mtx_ ); }
+#endif
 private:
     mutexor ( const mutexor &rhs );
     mutexor & operator = ( const mutexor &rhs );
+#if !LIBCXXABI_SINGLE_THREADED
     pthread_mutex_t *mtx_;
+#endif
     };