]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libsanitizer/lsan/lsan_thread.h
1 //=-- lsan_thread.h -------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // This file is a part of LeakSanitizer.
10 // Thread registry for standalone LSan.
12 //===----------------------------------------------------------------------===//
17 #include "sanitizer_common/sanitizer_thread_registry.h"
21 class ThreadContextLsanBase
: public ThreadContextBase
{
23 explicit ThreadContextLsanBase(int tid
);
24 void OnFinished() override
;
25 uptr
stack_begin() { return stack_begin_
; }
26 uptr
stack_end() { return stack_end_
; }
27 uptr
cache_begin() { return cache_begin_
; }
28 uptr
cache_end() { return cache_end_
; }
30 // The argument is passed on to the subclass's OnStarted member function.
31 static void ThreadStart(u32 tid
, tid_t os_id
, ThreadType thread_type
,
35 uptr stack_begin_
= 0;
37 uptr cache_begin_
= 0;
41 // This subclass of ThreadContextLsanBase is declared in an OS-specific header.
44 void InitializeThreadRegistry();
45 void InitializeMainThread();
47 u32
ThreadCreate(u32 tid
, uptr uid
, bool detached
, void *arg
= nullptr);
49 void ThreadJoin(u32 tid
);
50 u32
ThreadTid(uptr uid
);
52 u32
GetCurrentThread();
53 void SetCurrentThread(u32 tid
);
54 ThreadContext
*CurrentThreadContext();
55 void EnsureMainThreadIDIsCorrect();
59 #endif // LSAN_THREAD_H