1 //===-- tsan_mutex.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 "sanitizer_common/sanitizer_atomic.h"
15 #include "sanitizer_common/sanitizer_mutex.h"
16 #include "tsan_defs.h"
33 // This must be the last.
39 explicit Mutex(MutexType type
, StatType stat_type
);
51 atomic_uintptr_t state_
;
55 #if TSAN_COLLECT_STATS
60 void operator = (const Mutex
&);
63 typedef GenericScopedLock
<Mutex
> Lock
;
64 typedef GenericScopedReadLock
<Mutex
> ReadLock
;
66 class DeadlockDetector
{
69 void Lock(MutexType t
);
70 void Unlock(MutexType t
);
73 u64 locked_
[MutexTypeCount
];
76 void InitializeMutex();
80 #endif // TSAN_MUTEX_H