From 826c148aa5af36cca688b7da447bc0b22905d904 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Wed, 28 Jul 2010 22:49:43 +0000 Subject: Add an erase() method to llvm::ThreadLocal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109686 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/System/ThreadLocal.cpp | 4 ++++ lib/System/Unix/ThreadLocal.inc | 1 + lib/System/Win32/ThreadLocal.inc | 4 ++++ 3 files changed, 9 insertions(+) (limited to 'lib/System') diff --git a/lib/System/ThreadLocal.cpp b/lib/System/ThreadLocal.cpp index e7054b5..b84a8e7 100644 --- a/lib/System/ThreadLocal.cpp +++ b/lib/System/ThreadLocal.cpp @@ -67,6 +67,10 @@ const void* ThreadLocalImpl::getInstance() { return pthread_getspecific(*key); } +void ThreadLocalImpl::removeInstance() { + setInstance(0); +} + } #elif defined(LLVM_ON_UNIX) diff --git a/lib/System/Unix/ThreadLocal.inc b/lib/System/Unix/ThreadLocal.inc index 83d554d..6769520 100644 --- a/lib/System/Unix/ThreadLocal.inc +++ b/lib/System/Unix/ThreadLocal.inc @@ -22,4 +22,5 @@ ThreadLocalImpl::ThreadLocalImpl() { } ThreadLocalImpl::~ThreadLocalImpl() { } void ThreadLocalImpl::setInstance(const void* d) { data = const_cast(d);} const void* ThreadLocalImpl::getInstance() { return data; } +void ThreadLocalImpl::removeInstance() { setInstance(0); } } diff --git a/lib/System/Win32/ThreadLocal.inc b/lib/System/Win32/ThreadLocal.inc index c8f7840..b8b933c 100644 --- a/lib/System/Win32/ThreadLocal.inc +++ b/lib/System/Win32/ThreadLocal.inc @@ -46,4 +46,8 @@ void ThreadLocalImpl::setInstance(const void* d){ assert(errorcode != 0); } +void ThreadLocalImpl::removeInstance() { + setInstance(0); +} + } -- cgit v1.1