]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libitm/config/linux/rwlock.h
Update copyright in libitm.
[thirdparty/gcc.git] / libitm / config / linux / rwlock.h
index e5a53c054f6095bdfde3c9346fe50aaef642fe7c..428299f1be89107d9ade254ee8941e617b778e14 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2013 Free Software Foundation, Inc.
    Contributed by Torvald Riegel <triegel@redhat.com>.
 
    This file is part of the GNU Transactional Memory Library (libitm).
@@ -57,6 +57,15 @@ class gtm_rwlock
   void write_unlock ();
 
   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 writers.load (memory_order_relaxed) != 0;
+  }
 
  protected:
   bool write_lock_generic (gtm_thread *tx);