14 #include "llvm/Config/config.h"
22 #if !defined(LLVM_ENABLE_THREADS) || LLVM_ENABLE_THREADS == 0
29 typedef int SIZE_TOO_BIG[
sizeof(d) <=
sizeof(
data) ? 1 : -1];
30 void **pd =
reinterpret_cast<void**
>(&
data);
31 *pd =
const_cast<void*
>(d);
34 void **pd =
reinterpret_cast<void**
>(&
data);
43 #if defined(HAVE_PTHREAD_H) && defined(HAVE_PTHREAD_GETSPECIFIC)
53 typedef int SIZE_TOO_BIG[
sizeof(pthread_key_t) <=
sizeof(
data) ? 1 : -1];
54 pthread_key_t* key =
reinterpret_cast<pthread_key_t*
>(&
data);
55 int errorcode = pthread_key_create(key, NULL);
56 assert(errorcode == 0);
61 pthread_key_t* key =
reinterpret_cast<pthread_key_t*
>(&
data);
62 int errorcode = pthread_key_delete(*key);
63 assert(errorcode == 0);
68 pthread_key_t* key =
reinterpret_cast<pthread_key_t*
>(&
data);
69 int errorcode = pthread_setspecific(*key, d);
70 assert(errorcode == 0);
75 pthread_key_t* key =
reinterpret_cast<pthread_key_t*
>(&
data);
76 return pthread_getspecific(*key);
85 #elif defined(LLVM_ON_UNIX)
87 #elif defined( LLVM_ON_WIN32)
90 #warning Neither LLVM_ON_UNIX nor LLVM_ON_WIN32 set in Support/ThreadLocal.cpp
char data[sizeof(ThreadLocalDataTy)]
virtual ~ThreadLocalImpl()
const void * getInstance()
void setInstance(const void *d)