diff options
author | Sergey Matveev <earthdok@google.com> | 2013-05-27 10:35:51 +0000 |
---|---|---|
committer | Sergey Matveev <earthdok@google.com> | 2013-05-27 10:35:51 +0000 |
commit | 98d3b40ec5cf06e46397492c21acc9d18e8c54ab (patch) | |
tree | 966b40e7c774096d5574ee3f37ee2214ebec8d9c /lib/sanitizer_common/sanitizer_thread_registry.cc | |
parent | 57434a3174cfd9c4c5f304ea412492e4935cc18d (diff) |
[sanitizer] Move FindThreadByOSIdLocked from lsan to sanitizer_common.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@182728 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_thread_registry.cc')
-rw-r--r-- | lib/sanitizer_common/sanitizer_thread_registry.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_thread_registry.cc b/lib/sanitizer_common/sanitizer_thread_registry.cc index 22c7c5e19..466dc3b8a 100644 --- a/lib/sanitizer_common/sanitizer_thread_registry.cc +++ b/lib/sanitizer_common/sanitizer_thread_registry.cc @@ -180,6 +180,17 @@ ThreadRegistry::FindThreadContextLocked(FindThreadCallback cb, void *arg) { return 0; } +static bool FindThreadContextByOsIdCallback(ThreadContextBase *tctx, + void *arg) { + return (tctx->os_id == (uptr)arg && tctx->status != ThreadStatusInvalid && + tctx->status != ThreadStatusDead); +} + +ThreadContextBase *ThreadRegistry::FindThreadContextByOsIDLocked(uptr os_id) { + return FindThreadContextLocked(FindThreadContextByOsIdCallback, + (void *)os_id); +} + void ThreadRegistry::SetThreadName(u32 tid, const char *name) { BlockingMutexLock l(&mtx_); CHECK_LT(tid, n_contexts_); |