X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FSystem%2FThreadLocal.cpp;h=e7054b528147189d2f02fde53de63aa793e48fd2;hb=3ebd44d20ffd1a885a8ffd75541cfc2b4bc53e43;hp=74afa3e9538999710b3b2eff44c75593b978fa3a;hpb=7e026b74dd1fdaa81a147488423571c59079d9bb;p=oota-llvm.git diff --git a/lib/System/ThreadLocal.cpp b/lib/System/ThreadLocal.cpp index 74afa3e9538..e7054b52814 100644 --- a/lib/System/ThreadLocal.cpp +++ b/lib/System/ThreadLocal.cpp @@ -25,8 +25,8 @@ namespace llvm { using namespace sys; ThreadLocalImpl::ThreadLocalImpl() { } ThreadLocalImpl::~ThreadLocalImpl() { } -void ThreadLocalImpl::setInstance(void* d) { data = d; } -void* ThreadLocalImpl::getInstance() { return data; } +void ThreadLocalImpl::setInstance(const void* d) { data = const_cast(d);} +const void* ThreadLocalImpl::getInstance() { return data; } } #else @@ -43,23 +43,26 @@ 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(data); int errorcode = pthread_key_delete(*key); assert(errorcode == 0); + (void) errorcode; delete key; } -void ThreadLocalImpl::setInstance(void* d) { +void ThreadLocalImpl::setInstance(const void* d) { pthread_key_t* key = static_cast(data); int errorcode = pthread_setspecific(*key, d); assert(errorcode == 0); + (void) errorcode; } -void* ThreadLocalImpl::getInstance() { +const void* ThreadLocalImpl::getInstance() { pthread_key_t* key = static_cast(data); return pthread_getspecific(*key); }