Changeset View
Changeset View
Standalone View
Standalone View
compiler-rt/lib/scudo/standalone/tsd_exclusive.h
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | NOINLINE void initThread(Allocator *Instance, bool MinimalInit) { | ||||
Instance->callPostInitCallback(); | Instance->callPostInitCallback(); | ||||
} | } | ||||
pthread_key_t PThreadKey; | pthread_key_t PThreadKey; | ||||
bool Initialized; | bool Initialized; | ||||
atomic_u8 Disabled; | atomic_u8 Disabled; | ||||
TSD<Allocator> FallbackTSD; | TSD<Allocator> FallbackTSD; | ||||
HybridMutex Mutex; | HybridMutex Mutex; | ||||
static THREADLOCAL ThreadState State; | static thread_local ThreadState State; | ||||
static THREADLOCAL TSD<Allocator> ThreadTSD; | static thread_local TSD<Allocator> ThreadTSD; | ||||
friend void teardownThread<Allocator>(void *Ptr); | friend void teardownThread<Allocator>(void *Ptr); | ||||
}; | }; | ||||
template <class Allocator> | template <class Allocator> | ||||
THREADLOCAL TSD<Allocator> TSDRegistryExT<Allocator>::ThreadTSD; | thread_local TSD<Allocator> TSDRegistryExT<Allocator>::ThreadTSD; | ||||
template <class Allocator> | template <class Allocator> | ||||
THREADLOCAL ThreadState TSDRegistryExT<Allocator>::State; | thread_local ThreadState TSDRegistryExT<Allocator>::State; | ||||
template <class Allocator> void teardownThread(void *Ptr) { | template <class Allocator> void teardownThread(void *Ptr) { | ||||
typedef TSDRegistryExT<Allocator> TSDRegistryT; | typedef TSDRegistryExT<Allocator> TSDRegistryT; | ||||
Allocator *Instance = reinterpret_cast<Allocator *>(Ptr); | Allocator *Instance = reinterpret_cast<Allocator *>(Ptr); | ||||
// The glibc POSIX thread-local-storage deallocation routine calls user | // The glibc POSIX thread-local-storage deallocation routine calls user | ||||
// provided destructors in a loop of PTHREAD_DESTRUCTOR_ITERATIONS. | // provided destructors in a loop of PTHREAD_DESTRUCTOR_ITERATIONS. | ||||
// We want to be called last since other destructors might call free and the | // We want to be called last since other destructors might call free and the | ||||
// like, so we wait until PTHREAD_DESTRUCTOR_ITERATIONS before draining the | // like, so we wait until PTHREAD_DESTRUCTOR_ITERATIONS before draining the | ||||
Show All 15 Lines |