Remove duplicated definition in risc-v vector support.
[official-gcc.git] / libsanitizer / lsan / lsan_thread.h
blob709a02915c2d94ac9661427606584bddd444d788
1 //=-- lsan_thread.h -------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file is a part of LeakSanitizer.
10 // Thread registry for standalone LSan.
12 //===----------------------------------------------------------------------===//
14 #ifndef LSAN_THREAD_H
15 #define LSAN_THREAD_H
17 #include "sanitizer_common/sanitizer_thread_registry.h"
19 namespace __lsan {
21 class ThreadContextLsanBase : public ThreadContextBase {
22 public:
23 explicit ThreadContextLsanBase(int tid);
24 void OnStarted(void *arg) override;
25 void OnFinished() override;
26 uptr stack_begin() { return stack_begin_; }
27 uptr stack_end() { return stack_end_; }
28 uptr cache_begin() { return cache_begin_; }
29 uptr cache_end() { return cache_end_; }
31 // The argument is passed on to the subclass's OnStarted member function.
32 static void ThreadStart(u32 tid, tid_t os_id, ThreadType thread_type,
33 void *onstarted_arg);
35 protected:
36 ~ThreadContextLsanBase() {}
37 uptr stack_begin_ = 0;
38 uptr stack_end_ = 0;
39 uptr cache_begin_ = 0;
40 uptr cache_end_ = 0;
43 // This subclass of ThreadContextLsanBase is declared in an OS-specific header.
44 class ThreadContext;
46 void InitializeThreadRegistry();
47 void InitializeMainThread();
49 ThreadRegistry *GetLsanThreadRegistryLocked();
51 u32 ThreadCreate(u32 tid, bool detached, void *arg = nullptr);
52 void ThreadFinish();
54 ThreadContextLsanBase *GetCurrentThread();
55 inline u32 GetCurrentThreadId() {
56 ThreadContextLsanBase *ctx = GetCurrentThread();
57 return ctx ? ctx->tid : kInvalidTid;
59 void SetCurrentThread(ThreadContextLsanBase *tctx);
60 void EnsureMainThreadIDIsCorrect();
62 } // namespace __lsan
64 #endif // LSAN_THREAD_H