summaryrefslogtreecommitdiff
path: root/libitm/beginend.cc
diff options
context:
space:
mode:
authorTorvald Riegel <triegel@redhat.com>2016-01-13 21:39:50 +0000
committerTorvald Riegel <torvald@gcc.gnu.org>2016-01-13 21:39:50 +0000
commite89137cec128dad3b99a6777cfb482d10b86202e (patch)
treef3fe271c07e10062083b39e97936296bb9ccdca5 /libitm/beginend.cc
parentd6683aec5e2b72a0b3ce8cc8d9385482bbfdfe4d (diff)
downloadgcc-e89137cec128dad3b99a6777cfb482d10b86202e.tar.gz
libitm: Fix seq-cst MOs/fences in rwlock.
From-SVN: r232353
Diffstat (limited to 'libitm/beginend.cc')
-rw-r--r--libitm/beginend.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/libitm/beginend.cc b/libitm/beginend.cc
index 85fb4f13ed5..00d28f4efb6 100644
--- a/libitm/beginend.cc
+++ b/libitm/beginend.cc
@@ -619,8 +619,10 @@ GTM::gtm_thread::trycommit ()
// acquisitions). This ensures that if we read prior to other
// reader transactions setting their shared_state to 0, then those
// readers will observe our updates. We can reuse the seq_cst fence
- // in serial_lock.read_unlock() however, so we don't need another
- // one here.
+ // in serial_lock.read_unlock() if we performed that; if not, we
+ // issue the fence.
+ if (do_read_unlock)
+ atomic_thread_fence (memory_order_seq_cst);
// TODO Don't just spin but also block using cond vars / futexes
// here. Should probably be integrated with the serial lock code.
for (gtm_thread *it = gtm_thread::list_of_threads; it != 0;