summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System/ThreadLocal.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-06-25 23:31:18 +0000
committerOwen Anderson <resistor@mac.com>2009-06-25 23:31:18 +0000
commiteba6e652913927732e475b31f5c034f6dafa7bdf (patch)
tree0e2dcd5238e808e3f454506ca4632a1eee42bd50 /llvm/lib/System/ThreadLocal.cpp
parenteb511118518f3ae622a554c3c4de2ffe32184db1 (diff)
downloadbcm5719-llvm-eba6e652913927732e475b31f5c034f6dafa7bdf.tar.gz
bcm5719-llvm-eba6e652913927732e475b31f5c034f6dafa7bdf.zip
Add support for const thread locals.
llvm-svn: 74226
Diffstat (limited to 'llvm/lib/System/ThreadLocal.cpp')
-rw-r--r--llvm/lib/System/ThreadLocal.cpp8
1 files changed, 4 insertions, 4 deletions
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<void*>(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<pthread_key_t*>(data);
int errorcode = pthread_setspecific(*key, d);
assert(errorcode == 0);
}
-void* ThreadLocalImpl::getInstance() {
+const void* ThreadLocalImpl::getInstance() {
pthread_key_t* key = static_cast<pthread_key_t*>(data);
return pthread_getspecific(*key);
}
OpenPOWER on IntegriCloud