소스 검색

Completely remove the CAS loop in mutex.

ticki 8 년 전
부모
커밋
68caac6f2b
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/sync.rs

+ 1 - 1
src/sync.rs

@@ -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}
             // |)``)