Skip to content
Snippets Groups Projects
Unverified Commit 68caac6f authored by ticki's avatar ticki
Browse files

Completely remove the CAS loop in mutex.

parent c6bccdcb
No related branches found
No related tags found
No related merge requests found
...@@ -37,7 +37,7 @@ impl<T> Mutex<T> { ...@@ -37,7 +37,7 @@ impl<T> Mutex<T> {
pub fn lock(&self) -> MutexGuard<T> { pub fn lock(&self) -> MutexGuard<T> {
// Lock the mutex. // Lock the mutex.
#[cfg(not(feature = "unsafe_no_mutex_lock"))] #[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} // {O,o}
// |)``) // |)``)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment