diff options
Diffstat (limited to 'lib/sanitizer_common/sanitizer_thread_registry.cc')
| -rw-r--r-- | lib/sanitizer_common/sanitizer_thread_registry.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_thread_registry.cc b/lib/sanitizer_common/sanitizer_thread_registry.cc index 466dc3b8a27f..bfa29a19cd2d 100644 --- a/lib/sanitizer_common/sanitizer_thread_registry.cc +++ b/lib/sanitizer_common/sanitizer_thread_registry.cc @@ -85,7 +85,7 @@ void ThreadContextBase::Reset() { // ThreadRegistry implementation. -const u32 ThreadRegistry::kUnknownTid = -1U; +const u32 ThreadRegistry::kUnknownTid = ~0U; ThreadRegistry::ThreadRegistry(ThreadContextFactory factory, u32 max_threads, u32 thread_quarantine_size) @@ -200,6 +200,18 @@ void ThreadRegistry::SetThreadName(u32 tid, const char *name) { tctx->SetName(name); } +void ThreadRegistry::SetThreadNameByUserId(uptr user_id, const char *name) { + BlockingMutexLock l(&mtx_); + for (u32 tid = 0; tid < n_contexts_; tid++) { + ThreadContextBase *tctx = threads_[tid]; + if (tctx != 0 && tctx->user_id == user_id && + tctx->status != ThreadStatusInvalid) { + tctx->SetName(name); + return; + } + } +} + void ThreadRegistry::DetachThread(u32 tid) { BlockingMutexLock l(&mtx_); CHECK_LT(tid, n_contexts_); |
