diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2012-08-15 19:34:23 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2012-08-15 19:34:23 +0000 |
commit | 58b69754af0cbff56b1cfce9be9392e4451f6628 (patch) | |
tree | eacfc83d988e4b9d11114387ae7dc41243f2a363 /include/llvm/Support/ThreadLocal.h | |
parent | 0378662f5bd3dbe8305a485b0282bceb8b52f465 (diff) |
Notes
Diffstat (limited to 'include/llvm/Support/ThreadLocal.h')
-rw-r--r-- | include/llvm/Support/ThreadLocal.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/include/llvm/Support/ThreadLocal.h b/include/llvm/Support/ThreadLocal.h index 15350a7afff7e..62ec90ad24f55 100644 --- a/include/llvm/Support/ThreadLocal.h +++ b/include/llvm/Support/ThreadLocal.h @@ -15,6 +15,7 @@ #define LLVM_SYSTEM_THREAD_LOCAL_H #include "llvm/Support/Threading.h" +#include "llvm/Support/DataTypes.h" #include <cassert> namespace llvm { @@ -22,7 +23,15 @@ namespace llvm { // ThreadLocalImpl - Common base class of all ThreadLocal instantiations. // YOU SHOULD NEVER USE THIS DIRECTLY. class ThreadLocalImpl { - void* data; + typedef uint64_t ThreadLocalDataTy; + /// \brief Platform-specific thread local data. + /// + /// This is embedded in the class and we avoid malloc'ing/free'ing it, + /// to make this class more safe for use along with CrashRecoveryContext. + union { + char data[sizeof(ThreadLocalDataTy)]; + ThreadLocalDataTy align_data; + }; public: ThreadLocalImpl(); virtual ~ThreadLocalImpl(); |