Unverified Commit 68caac6f authored by ticki's avatar ticki
Browse files

Completely remove the CAS loop in mutex.

parent c6bccdcb
......@@ -37,7 +37,7 @@ impl<T> Mutex<T> {
pub fn lock(&self) -> MutexGuard<T> {
// Lock the mutex.
#[cfg(not(feature = "unsafe_no_mutex_lock"))]
while self.locked.compare_and_swap(false, true, atomic::Ordering::Acquire) {
while self.locked.swap(true, atomic::Ordering::Acquire) {
// ,___,
// {O,o}
// |)``)
......
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