Changeset View
Changeset View
Standalone View
Standalone View
lib/scudo/scudo_tsd_shared.inc
Show All 11 Lines | |||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#ifndef SCUDO_TSD_H_ | #ifndef SCUDO_TSD_H_ | ||||
# error "This file must be included inside scudo_tsd.h." | # error "This file must be included inside scudo_tsd.h." | ||||
#endif // SCUDO_TSD_H_ | #endif // SCUDO_TSD_H_ | ||||
#if !SCUDO_TSD_EXCLUSIVE | #if !SCUDO_TSD_EXCLUSIVE | ||||
#if SANITIZER_WINDOWS | |||||
extern DWORD TlsIndex; | |||||
#elif !SANITIZER_ANDROID | |||||
extern pthread_key_t PThreadKey; | extern pthread_key_t PThreadKey; | ||||
#endif | |||||
ALWAYS_INLINE ScudoTSD* getCurrentTSD() { | ALWAYS_INLINE ScudoTSD* getCurrentTSD() { | ||||
#if SANITIZER_ANDROID | #if SANITIZER_WINDOWS | ||||
return reinterpret_cast<ScudoTSD *>(TlsGetValue(TlsIndex)); | |||||
#elif SANITIZER_ANDROID | |||||
return reinterpret_cast<ScudoTSD *>(*get_android_tls_ptr()); | return reinterpret_cast<ScudoTSD *>(*get_android_tls_ptr()); | ||||
#else | #else | ||||
return reinterpret_cast<ScudoTSD *>(pthread_getspecific(PThreadKey)); | return reinterpret_cast<ScudoTSD *>(pthread_getspecific(PThreadKey)); | ||||
#endif // SANITIZER_ANDROID | #endif // SANITIZER_ANDROID | ||||
} | } | ||||
ALWAYS_INLINE void initThreadMaybe(bool MinimalInit = false) { | ALWAYS_INLINE void initThreadMaybe(bool MinimalInit = false) { | ||||
if (LIKELY(getCurrentTSD())) | if (LIKELY(getCurrentTSD())) | ||||
Show All 17 Lines |