[llvm-commits] [llvm] r109683 - /llvm/trunk/include/llvm/System/ThreadLocal.h
Owen Anderson
resistor at mac.com
Wed Jul 28 15:30:53 PDT 2010
Author: resistor
Date: Wed Jul 28 17:30:53 2010
New Revision: 109683
URL: http://llvm.org/viewvc/llvm-project?rev=109683&view=rev
Log:
Add more doxygen comments for llvm::ThreadLocal.
Modified:
llvm/trunk/include/llvm/System/ThreadLocal.h
Modified: llvm/trunk/include/llvm/System/ThreadLocal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/ThreadLocal.h?rev=109683&r1=109682&r2=109683&view=diff
==============================================================================
--- llvm/trunk/include/llvm/System/ThreadLocal.h (original)
+++ llvm/trunk/include/llvm/System/ThreadLocal.h Wed Jul 28 17:30:53 2010
@@ -19,6 +19,8 @@
namespace llvm {
namespace sys {
+ // ThreadLocalImpl - Common base class of all ThreadLocal instantiations.
+ // YOU SHOULD NEVER USE THIS DIRECTLY.
class ThreadLocalImpl {
void* data;
public:
@@ -28,11 +30,18 @@
const void* getInstance();
};
+ /// ThreadLocal - A class used to abstract thread-local storage. It holds,
+ /// for each thread, a pointer a single object of type T.
template<class T>
class ThreadLocal : public ThreadLocalImpl {
public:
ThreadLocal() : ThreadLocalImpl() { }
+
+ /// get - Fetches a pointer to the object associated with the current
+ /// thread. If no object has yet been associated, it returns NULL;
T* get() { return static_cast<T*>(getInstance()); }
+
+ // set - Associates a pointer to an object with the current thread.
void set(T* d) { setInstance(d); }
};
}
More information about the llvm-commits
mailing list