System/Path/Windows: Make GetSystemLibraryPaths more generic.
[oota-llvm.git] / lib / System / ThreadLocal.cpp
index f8b00d152a0c2d484bc5842101664b4c0138173b..f6a55a1c0b9b183b1fbccc7976e52bf95406abbc 100644 (file)
@@ -27,6 +27,7 @@ ThreadLocalImpl::ThreadLocalImpl() { }
 ThreadLocalImpl::~ThreadLocalImpl() { }
 void ThreadLocalImpl::setInstance(const void* d) { data = const_cast<void*>(d);}
 const void* ThreadLocalImpl::getInstance() { return data; }
+void ThreadLocalImpl::removeInstance() { data = 0; }
 }
 #else
 
@@ -43,13 +44,15 @@ ThreadLocalImpl::ThreadLocalImpl() : data(0) {
   pthread_key_t* key = new pthread_key_t;
   int errorcode = pthread_key_create(key, NULL);
   assert(errorcode == 0);
-  data = key;
+  (void) errorcode;
+  data = (void*)key;
 }
 
 ThreadLocalImpl::~ThreadLocalImpl() {
   pthread_key_t* key = static_cast<pthread_key_t*>(data);
   int errorcode = pthread_key_delete(*key);
   assert(errorcode == 0);
+  (void) errorcode;
   delete key;
 }
 
@@ -57,6 +60,7 @@ void ThreadLocalImpl::setInstance(const void* d) {
   pthread_key_t* key = static_cast<pthread_key_t*>(data);
   int errorcode = pthread_setspecific(*key, d);
   assert(errorcode == 0);
+  (void) errorcode;
 }
 
 const void* ThreadLocalImpl::getInstance() {
@@ -64,6 +68,10 @@ const void* ThreadLocalImpl::getInstance() {
   return pthread_getspecific(*key);
 }
 
+void ThreadLocalImpl::removeInstance() {
+  setInstance(0);
+}
+
 }
 
 #elif defined(LLVM_ON_UNIX)