From eba6e652913927732e475b31f5c034f6dafa7bdf Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Thu, 25 Jun 2009 23:31:18 +0000 Subject: Add support for const thread locals. llvm-svn: 74226 --- llvm/lib/System/ThreadLocal.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib/System/ThreadLocal.cpp') diff --git a/llvm/lib/System/ThreadLocal.cpp b/llvm/lib/System/ThreadLocal.cpp index 74afa3e9538..f8b00d152a0 100644 --- a/llvm/lib/System/ThreadLocal.cpp +++ b/llvm/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 @@ -53,13 +53,13 @@ ThreadLocalImpl::~ThreadLocalImpl() { 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* ThreadLocalImpl::getInstance() { +const void* ThreadLocalImpl::getInstance() { pthread_key_t* key = static_cast(data); return pthread_getspecific(*key); } -- cgit v1.2.3