summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_thread_registry.h
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2014-04-11 15:38:03 +0000
committerDmitry Vyukov <dvyukov@google.com>2014-04-11 15:38:03 +0000
commitfa03a29e8a3d86d528fc81a41dcf2dca113ec55e (patch)
treec45bb9269d8e8da42ae05f20b0440124ef2a7666 /lib/sanitizer_common/sanitizer_thread_registry.h
parent85636ba0636a093fa4e2250e9a2f0ee6c8716827 (diff)
tsan: fix vector clocks
the new optimizations break when thread ids gets reused (clocks go backwards) add the necessary tests as well git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206035 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_thread_registry.h')
-rw-r--r--lib/sanitizer_common/sanitizer_thread_registry.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/sanitizer_common/sanitizer_thread_registry.h b/lib/sanitizer_common/sanitizer_thread_registry.h
index a59bba570..8bb7ff384 100644
--- a/lib/sanitizer_common/sanitizer_thread_registry.h
+++ b/lib/sanitizer_common/sanitizer_thread_registry.h
@@ -38,13 +38,13 @@ class ThreadContextBase {
const u32 tid; // Thread ID. Main thread should have tid = 0.
u64 unique_id; // Unique thread ID.
+ u32 reuse_count; // Number of times this tid was reused.
uptr os_id; // PID (used for reporting).
uptr user_id; // Some opaque user thread id (e.g. pthread_t).
char name[64]; // As annotated by user.
ThreadStatus status;
bool detached;
- int reuse_count;
u32 parent_tid;
ThreadContextBase *next; // For storing thread contexts in a list.
@@ -77,7 +77,7 @@ class ThreadRegistry {
static const u32 kUnknownTid;
ThreadRegistry(ThreadContextFactory factory, u32 max_threads,
- u32 thread_quarantine_size);
+ u32 thread_quarantine_size, u32 max_reuse = 0);
void GetNumberOfThreads(uptr *total = 0, uptr *running = 0, uptr *alive = 0);
uptr GetMaxAliveThreads();
@@ -119,6 +119,7 @@ class ThreadRegistry {
const ThreadContextFactory context_factory_;
const u32 max_threads_;
const u32 thread_quarantine_size_;
+ const u32 max_reuse_;
BlockingMutex mtx_;