Skip to content

Commit 15213ac

Browse files
committedMay 2, 2016
Alter once to use acquire semantics for fast path
1 parent d80497e commit 15213ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

Diff for: ‎src/libstd/sync/once.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ impl Once {
201201
#[stable(feature = "rust1", since = "1.0.0")]
202202
pub fn call_once<F>(&'static self, f: F) where F: FnOnce() {
203203
// Fast path, just see if we've completed initialization.
204-
if self.state.load(Ordering::SeqCst) == COMPLETE {
204+
if self.state.load(Ordering::Acquire) == COMPLETE {
205205
return
206206
}
207207

@@ -222,7 +222,7 @@ impl Once {
222222
#[unstable(feature = "once_poison", issue = "31688")]
223223
pub fn call_once_force<F>(&'static self, f: F) where F: FnOnce(&OnceState) {
224224
// same as above, just with a different parameter to `call_inner`.
225-
if self.state.load(Ordering::SeqCst) == COMPLETE {
225+
if self.state.load(Ordering::Acquire) == COMPLETE {
226226
return
227227
}
228228

0 commit comments

Comments
 (0)
Please sign in to comment.