1 //===-- tsan_clock.h --------------------------------------------*- C++ -*-===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
8 // This file is a part of ThreadSanitizer (TSan), a race detector.
10 //===----------------------------------------------------------------------===//
14 #include "tsan_defs.h"
15 #include "tsan_vector.h"
19 // The clock that lives in sync variables (mutexes, atomics, etc).
34 friend struct ThreadClock;
37 // The clock that lives in threads.
42 u64 get(unsigned tid) const {
43 DCHECK_LT(tid, kMaxTidInClock);
47 void set(unsigned tid, u64 v) {
48 DCHECK_LT(tid, kMaxTid);
49 DCHECK_GE(v, clk_[tid]);
55 void tick(unsigned tid) {
56 DCHECK_LT(tid, kMaxTid);
66 void acquire(const SyncClock *src);
67 void release(SyncClock *dst) const;
68 void acq_rel(SyncClock *dst);
69 void ReleaseStore(SyncClock *dst) const;
73 u64 clk_[kMaxTidInClock];
78 #endif // TSAN_CLOCK_H