Make Program::Wait differentiate execution failure due to the file
[oota-llvm.git] / lib / System / ThreadLocal.cpp
index b0c7fa56d7d354926e7203bd67bd091257fed480..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
 
@@ -44,7 +45,7 @@ ThreadLocalImpl::ThreadLocalImpl() : data(0) {
   int errorcode = pthread_key_create(key, NULL);
   assert(errorcode == 0);
   (void) errorcode;
-  data = static_cast<void*>(key);
+  data = (void*)key;
 }
 
 ThreadLocalImpl::~ThreadLocalImpl() {
@@ -67,6 +68,10 @@ const void* ThreadLocalImpl::getInstance() {
   return pthread_getspecific(*key);
 }
 
+void ThreadLocalImpl::removeInstance() {
+  setInstance(0);
+}
+
 }
 
 #elif defined(LLVM_ON_UNIX)