summaryrefslogtreecommitdiff
path: root/test/tsan/custom_mutex.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/tsan/custom_mutex.h')
-rw-r--r--test/tsan/custom_mutex.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/tsan/custom_mutex.h b/test/tsan/custom_mutex.h
index e3ac7a9a52a7f..8e226a170ec4f 100644
--- a/test/tsan/custom_mutex.h
+++ b/test/tsan/custom_mutex.h
@@ -6,15 +6,16 @@
// A very primitive mutex annotated with tsan annotations.
class Mutex {
public:
- Mutex(bool prof, unsigned flags)
+ Mutex(bool prof, unsigned create_flags, unsigned destroy_flags=0)
: prof_(prof)
, locked_(false)
- , seq_(0) {
- __tsan_mutex_create(this, flags);
+ , seq_(0)
+ , destroy_flags_(destroy_flags) {
+ __tsan_mutex_create(this, create_flags);
}
~Mutex() {
- __tsan_mutex_destroy(this, 0);
+ __tsan_mutex_destroy(this, destroy_flags_);
}
void Lock() {
@@ -57,6 +58,7 @@ class Mutex {
const bool prof_;
std::atomic<bool> locked_;
int seq_;
+ unsigned destroy_flags_;
// This models mutex profiling subsystem.
static Mutex prof_mu_;