summaryrefslogtreecommitdiff
path: root/libitm/beginend.cc
diff options
context:
space:
mode:
authortorvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4>2016-01-13 21:39:50 +0000
committertorvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4>2016-01-13 21:39:50 +0000
commitf7224fbc774ecdca189986c42f29be40ba26937d (patch)
treef3fe271c07e10062083b39e97936296bb9ccdca5 /libitm/beginend.cc
parent6d2bb523afc0c5eef405e1d0d297ef1029d4bde2 (diff)
libitm: Fix seq-cst MOs/fences in rwlock.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232353 138bc75d-0d04-0410-961f-82ee72b054a4
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 85fb4f13ed5b..00d28f4efb64 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;