Commit 999bcff5 by Torvald Riegel Committed by Torvald Riegel

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.

From-SVN: r183488
parent c873934c
2012-01-24 Torvald Riegel <triegel@redhat.com>
* config/linux/rwlock.cc (GTM::gtm_rwlock::write_unlock): Fix reader
wake-up.
2012-01-24 Uros Bizjak <ubizjak@gmail.com> 2012-01-24 Uros Bizjak <ubizjak@gmail.com>
* config/x86/target.h (gtm_jmpbuf) [__x86_64__]: Move rip to the * config/x86/target.h (gtm_jmpbuf) [__x86_64__]: Move rip to the
......
...@@ -231,10 +231,13 @@ gtm_rwlock::write_unlock () ...@@ -231,10 +231,13 @@ gtm_rwlock::write_unlock ()
// last writer (this can happen because write_lock_generic() // last writer (this can happen because write_lock_generic()
// exchanges 0 or 1 to 2 and thus might go to contended mode even if // 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 // no other thread holds the write lock currently). Therefore, we
// have to wake up readers here as well. // have to wake up readers here as well. Execute a barrier after
futex_wake(&readers, INT_MAX); // 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. // No waiting writers, so wake up all waiting readers.
// Because the fetch_and_sub is a full barrier already, we don't need // Because the fetch_and_sub is a full barrier already, we don't need
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment