diff options
author | torvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-01-24 19:17:05 +0000 |
---|---|---|
committer | torvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-01-24 19:17:05 +0000 |
commit | f6a8af68d712a6598fdbe2be60cb3912fa5a9c49 (patch) | |
tree | e26e3ce6a636f90d893869eb973d01b436295141 /libitm/config | |
parent | 5a3e2e7964e491e0d087b8d616f33c0ad459f8fa (diff) | |
download | gcc-f6a8af68d712a6598fdbe2be60cb3912fa5a9c49.tar.gz |
libitm: Fix wake-up of readers in futex-based serial lock.
libitm/
* config/linux/rwlock.cc (GTM::gtm_rwlock::write_unlock): Fix reader
wake-up.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183488 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libitm/config')
-rw-r--r-- | libitm/config/linux/rwlock.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libitm/config/linux/rwlock.cc b/libitm/config/linux/rwlock.cc index 24e7042ff10..ad1b042964a 100644 --- a/libitm/config/linux/rwlock.cc +++ b/libitm/config/linux/rwlock.cc @@ -231,10 +231,13 @@ gtm_rwlock::write_unlock () // last writer (this can happen because write_lock_generic() // exchanges 0 or 1 to 2 and thus might go to contended mode even if // no other thread holds the write lock currently). Therefore, we - // have to wake up readers here as well. - futex_wake(&readers, INT_MAX); + // have to wake up readers here as well. Execute a barrier after + // the previous relaxed reset of writers (Dekker-style), and fall + // through to the normal reader wake-up code. + atomic_thread_fence (memory_order_seq_cst); } - return; + else + return; } // No waiting writers, so wake up all waiting readers. // Because the fetch_and_sub is a full barrier already, we don't need |