summaryrefslogtreecommitdiff
path: root/libitm/config/posix
diff options
context:
space:
mode:
Diffstat (limited to 'libitm/config/posix')
-rw-r--r--libitm/config/posix/rwlock.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/libitm/config/posix/rwlock.h b/libitm/config/posix/rwlock.h
index a1a6042e562..79f14296df6 100644
--- a/libitm/config/posix/rwlock.h
+++ b/libitm/config/posix/rwlock.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2009, 2011, 2012 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU Transactional Memory Library (libitm).
@@ -74,6 +74,14 @@ class gtm_rwlock
bool write_upgrade (gtm_thread *tx);
void write_upgrade_finish (gtm_thread *tx);
+ // Returns true iff there is a concurrent active or waiting writer.
+ // This is primarily useful for simple HyTM approaches, and the value being
+ // checked is loaded with memory_order_relaxed.
+ bool is_write_locked()
+ {
+ return summary.load (memory_order_relaxed) & (a_writer | w_writer);
+ }
+
protected:
bool write_lock_generic (gtm_thread *tx);
};