Skip to content

Commit bbe5dde

Browse files
committed
relax a memory order in once_box
1 parent f79fae3 commit bbe5dde

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/std/src/sys/sync/once_box.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl<T> OnceBox<T> {
6060
#[cold]
6161
fn initialize(&self, f: impl FnOnce() -> Box<T>) -> &T {
6262
let new_ptr = Box::into_raw(f());
63-
match self.ptr.compare_exchange(null_mut(), new_ptr, AcqRel, Acquire) {
63+
match self.ptr.compare_exchange(null_mut(), new_ptr, Release, Acquire) {
6464
Ok(_) => unsafe { &*new_ptr },
6565
Err(ptr) => {
6666
// Lost the race to another thread.

0 commit comments

Comments
 (0)