Skip to content

Commit

Permalink
[NFC][sanitizer] Rename *ThreadRegistry functions
Browse files Browse the repository at this point in the history
Reviewed By: thurston

Differential Revision: https://reviews.llvm.org/D150407
  • Loading branch information
vitalybuka committed May 25, 2023
1 parent 3669d07 commit 07edc1c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions compiler-rt/lib/asan/asan_thread.cpp
Expand Up @@ -494,12 +494,12 @@ __asan::AsanThread *GetAsanThreadByOsIDLocked(tid_t os_id) {

// --- Implementation of LSan-specific functions --- {{{1
namespace __lsan {
void LockThreadRegistry() {
void LockThreads() {
__asan::asanThreadRegistry().Lock();
__asan::asanThreadArgRetval().Lock();
}

void UnlockThreadRegistry() {
void UnlockThreads() {
__asan::asanThreadArgRetval().Unlock();
__asan::asanThreadRegistry().Unlock();
}
Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/lib/hwasan/hwasan_thread.cpp
Expand Up @@ -174,12 +174,12 @@ static __hwasan::Thread *GetThreadByOsIDLocked(tid_t os_id) {
[os_id](__hwasan::Thread *t) { return t->os_id() == os_id; });
}

void LockThreadRegistry() {
void LockThreads() {
__hwasan::hwasanThreadList().Lock();
__hwasan::hwasanThreadArgRetval().Lock();
}

void UnlockThreadRegistry() {
void UnlockThreads() {
__hwasan::hwasanThreadArgRetval().Unlock();
__hwasan::hwasanThreadList().Unlock();
}
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/lsan/lsan.cpp
Expand Up @@ -97,7 +97,7 @@ extern "C" void __lsan_init() {
ReplaceSystemMalloc();
InitTlsSize();
InitializeInterceptors();
InitializeThreadRegistry();
InitializeThreads();
InstallDeadlySignalHandlers(LsanOnDeadlySignal);
InitializeMainThread();
InstallAtExitCheckLeaks();
Expand Down
8 changes: 4 additions & 4 deletions compiler-rt/lib/lsan/lsan_common.h
Expand Up @@ -96,8 +96,8 @@ bool WordIsPoisoned(uptr addr);
//// --------------------------------------------------------------------------

// Wrappers for ThreadRegistry access.
void LockThreadRegistry() SANITIZER_NO_THREAD_SAFETY_ANALYSIS;
void UnlockThreadRegistry() SANITIZER_NO_THREAD_SAFETY_ANALYSIS;
void LockThreads() SANITIZER_NO_THREAD_SAFETY_ANALYSIS;
void UnlockThreads() SANITIZER_NO_THREAD_SAFETY_ANALYSIS;
// If called from the main thread, updates the main thread's TID in the thread
// registry. We need this to handle processes that fork() without a subsequent
// exec(), which invalidates the recorded TID. To update it, we must call
Expand Down Expand Up @@ -160,13 +160,13 @@ IgnoreObjectResult IgnoreObject(const void *p);

struct ScopedStopTheWorldLock {
ScopedStopTheWorldLock() {
LockThreadRegistry();
LockThreads();
LockAllocator();
}

~ScopedStopTheWorldLock() {
UnlockAllocator();
UnlockThreadRegistry();
UnlockThreads();
}

ScopedStopTheWorldLock &operator=(const ScopedStopTheWorldLock &) = delete;
Expand Down
6 changes: 3 additions & 3 deletions compiler-rt/lib/lsan/lsan_thread.cpp
Expand Up @@ -34,7 +34,7 @@ static ThreadContextBase *CreateThreadContext(u32 tid) {
return new (allocator_for_thread_context) ThreadContext(tid);
}

void InitializeThreadRegistry() {
void InitializeThreads() {
static ALIGNED(alignof(
ThreadRegistry)) char thread_registry_placeholder[sizeof(ThreadRegistry)];
thread_registry =
Expand Down Expand Up @@ -83,12 +83,12 @@ void GetThreadExtraStackRangesLocked(tid_t os_id,
InternalMmapVector<Range> *ranges) {}
void GetThreadExtraStackRangesLocked(InternalMmapVector<Range> *ranges) {}

void LockThreadRegistry() {
void LockThreads() {
thread_registry->Lock();
thread_arg_retval->Lock();
}

void UnlockThreadRegistry() {
void UnlockThreads() {
thread_arg_retval->Unlock();
thread_registry->Unlock();
}
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/lsan/lsan_thread.h
Expand Up @@ -44,7 +44,7 @@ class ThreadContextLsanBase : public ThreadContextBase {
// This subclass of ThreadContextLsanBase is declared in an OS-specific header.
class ThreadContext;

void InitializeThreadRegistry();
void InitializeThreads();
void InitializeMainThread();

ThreadRegistry *GetLsanThreadRegistryLocked();
Expand Down

0 comments on commit 07edc1c

Please sign in to comment.