Skip to content

Commit 1993896

Browse files
authored
Merge pull request rust-lang#219 from dwrensha/seq-cst
Use SeqCst instead of Acquire and Release in Lock.
2 parents 43e290f + 703afd7 commit 1993896

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lock.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extern crate core;
88

99
use self::core::cell::UnsafeCell;
1010
use self::core::ops::{Deref, DerefMut};
11-
use self::core::sync::atomic::Ordering::{Acquire, Release};
11+
use self::core::sync::atomic::Ordering::{SeqCst};
1212
use self::core::sync::atomic::AtomicBool;
1313

1414
/// A "mutex" around a value, similar to `std::sync::Mutex<T>`.
@@ -54,7 +54,7 @@ impl<T> Lock<T> {
5454
/// If `None` is returned then the lock is already locked, either elsewhere
5555
/// on this thread or on another thread.
5656
pub fn try_lock(&self) -> Option<TryLock<T>> {
57-
if !self.locked.swap(true, Acquire) {
57+
if !self.locked.swap(true, SeqCst) {
5858
Some(TryLock { __ptr: self })
5959
} else {
6060
None
@@ -84,7 +84,7 @@ impl<'a, T> DerefMut for TryLock<'a, T> {
8484

8585
impl<'a, T> Drop for TryLock<'a, T> {
8686
fn drop(&mut self) {
87-
self.__ptr.locked.store(false, Release);
87+
self.__ptr.locked.store(false, SeqCst);
8888
}
8989
}
9090

0 commit comments

Comments
 (0)