1 //=-- lsan_thread.h -------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file is a part of LeakSanitizer.
11 // Thread registry for standalone LSan.
13 //===----------------------------------------------------------------------===//
18 #include "sanitizer_common/sanitizer_thread_registry.h"
20 namespace __sanitizer {
26 class ThreadContext : public ThreadContextBase {
28 explicit ThreadContext(int tid);
29 void OnStarted(void *arg) override;
30 void OnFinished() override;
31 uptr stack_begin() { return stack_begin_; }
32 uptr stack_end() { return stack_end_; }
33 uptr tls_begin() { return tls_begin_; }
34 uptr tls_end() { return tls_end_; }
35 uptr cache_begin() { return cache_begin_; }
36 uptr cache_end() { return cache_end_; }
37 DTLS *dtls() { return dtls_; }
40 uptr stack_begin_, stack_end_,
41 cache_begin_, cache_end_,
46 void InitializeThreadRegistry();
48 void ThreadStart(u32 tid, uptr os_id);
50 u32 ThreadCreate(u32 tid, uptr uid, bool detached);
51 void ThreadJoin(u32 tid);
52 u32 ThreadTid(uptr uid);
54 u32 GetCurrentThread();
55 void SetCurrentThread(u32 tid);
56 ThreadContext *CurrentThreadContext();
57 void EnsureMainThreadIDIsCorrect();
60 #endif // LSAN_THREAD_H