forked from OSchip/llvm-project
s/LIBCXXABI_SINGLE_THREADED/LIBCXXABI_HAS_NO_THREADS/ for consistency with libcxx
Also remove the audotedection part so that if you're crazy enough to want a single-threaded abi library, you'll say so explicitly in the build. llvm-svn: 217262
This commit is contained in:
parent
3547c5441e
commit
3b7f085db1
|
@ -16,11 +16,9 @@
|
|||
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(LIBCXXABI_SINGLE_THREADED) && \
|
||||
defined(_POSIX_THREADS) && _POSIX_THREADS > 0
|
||||
# define LIBCXXABI_SINGLE_THREADED 0
|
||||
#else
|
||||
# define LIBCXXABI_SINGLE_THREADED 1
|
||||
// Set this in the CXXFLAGS when you need it
|
||||
#if !defined(LIBCXXABI_HAS_NO_THREADS)
|
||||
# define LIBCXXABI_HAS_NO_THREADS 0
|
||||
#endif
|
||||
|
||||
// Set this in the CXXFLAGS when you need it, because otherwise we'd have to
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <exception> // for std::terminate
|
||||
#include <cstdlib> // for malloc, free
|
||||
#include <cstring> // for memset
|
||||
#if !LIBCXXABI_SINGLE_THREADED
|
||||
#if !LIBCXXABI_HAS_NO_THREADS
|
||||
# include <pthread.h> // for fallback_malloc.ipp's mutexes
|
||||
#endif
|
||||
#include "cxa_exception.hpp"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#if LIBCXXABI_SINGLE_THREADED
|
||||
#if LIBCXXABI_HAS_NO_THREADS
|
||||
|
||||
namespace __cxxabiv1 {
|
||||
extern "C" {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "abort_message.h"
|
||||
#include "config.h"
|
||||
|
||||
#if !LIBCXXABI_SINGLE_THREADED
|
||||
#if !LIBCXXABI_HAS_NO_THREADS
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
|
@ -62,7 +62,7 @@ void set_initialized(guard_type* guard_object) {
|
|||
|
||||
#endif
|
||||
|
||||
#if !LIBCXXABI_SINGLE_THREADED
|
||||
#if !LIBCXXABI_HAS_NO_THREADS
|
||||
pthread_mutex_t guard_mut = PTHREAD_MUTEX_INITIALIZER;
|
||||
pthread_cond_t guard_cv = PTHREAD_COND_INITIALIZER;
|
||||
#endif
|
||||
|
@ -166,7 +166,7 @@ set_lock(uint32_t& x, lock_type y)
|
|||
extern "C"
|
||||
{
|
||||
|
||||
#if LIBCXXABI_SINGLE_THREADED
|
||||
#if LIBCXXABI_HAS_NO_THREADS
|
||||
int __cxa_guard_acquire(guard_type* guard_object)
|
||||
{
|
||||
return !is_initialized(guard_object);
|
||||
|
@ -183,7 +183,7 @@ void __cxa_guard_abort(guard_type* guard_object)
|
|||
*guard_object = 0;
|
||||
}
|
||||
|
||||
#else // !LIBCXXABI_SINGLE_THREADED
|
||||
#else // !LIBCXXABI_HAS_NO_THREADS
|
||||
|
||||
int __cxa_guard_acquire(guard_type* guard_object)
|
||||
{
|
||||
|
@ -250,7 +250,7 @@ void __cxa_guard_abort(guard_type* guard_object)
|
|||
abort_message("__cxa_guard_abort failed to broadcast condition variable");
|
||||
}
|
||||
|
||||
#endif // !LIBCXXABI_SINGLE_THREADED
|
||||
#endif // !LIBCXXABI_HAS_NO_THREADS
|
||||
|
||||
} // extern "C"
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
namespace {
|
||||
|
||||
// When POSIX threads are not available, make the mutex operations a nop
|
||||
#if LIBCXXABI_SINGLE_THREADED
|
||||
#if LIBCXXABI_HAS_NO_THREADS
|
||||
static void * heap_mutex = 0;
|
||||
#else
|
||||
static pthread_mutex_t heap_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
@ -34,7 +34,7 @@ static pthread_mutex_t heap_mutex = PTHREAD_MUTEX_INITIALIZER;
|
|||
|
||||
class mutexor {
|
||||
public:
|
||||
#if LIBCXXABI_SINGLE_THREADED
|
||||
#if LIBCXXABI_HAS_NO_THREADS
|
||||
mutexor ( void * ) {}
|
||||
~mutexor () {}
|
||||
#else
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
private:
|
||||
mutexor ( const mutexor &rhs );
|
||||
mutexor & operator = ( const mutexor &rhs );
|
||||
#if !LIBCXXABI_SINGLE_THREADED
|
||||
#if !LIBCXXABI_HAS_NO_THREADS
|
||||
pthread_mutex_t *mtx_;
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <cstdlib>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#if !LIBCXXABI_SINGLE_THREADED
|
||||
#if !LIBCXXABI_HAS_NO_THREADS
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
|
@ -38,7 +38,7 @@ void *thread_code (void *parm) {
|
|||
return parm;
|
||||
}
|
||||
|
||||
#if !LIBCXXABI_SINGLE_THREADED
|
||||
#if !LIBCXXABI_HAS_NO_THREADS
|
||||
#define NUMTHREADS 10
|
||||
size_t thread_globals [ NUMTHREADS ] = { 0 };
|
||||
pthread_t threads [ NUMTHREADS ];
|
||||
|
@ -54,7 +54,7 @@ void print_sizes ( size_t *first, size_t *last ) {
|
|||
int main ( int argc, char *argv [] ) {
|
||||
int retVal = 0;
|
||||
|
||||
#if LIBCXXABI_SINGLE_THREADED
|
||||
#if LIBCXXABI_HAS_NO_THREADS
|
||||
size_t thread_globals;
|
||||
retVal = thread_code(&thread_globals) != 0;
|
||||
#else
|
||||
|
|
Loading…
Reference in New Issue