Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e43aef0

Browse files
committed
SeqCst->{Release,Acquire} in sys_common::thread_local_key.
SeqCst is unnecessary here.
1 parent 516684c commit e43aef0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/std/src/sys_common/thread_local_key.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl StaticKey {
128128

129129
#[inline]
130130
unsafe fn key(&self) -> imp::Key {
131-
match self.key.load(Ordering::Relaxed) {
131+
match self.key.load(Ordering::Acquire) {
132132
KEY_SENTVAL => self.lazy_init() as imp::Key,
133133
n => n as imp::Key,
134134
}
@@ -156,8 +156,8 @@ impl StaticKey {
156156
match self.key.compare_exchange(
157157
KEY_SENTVAL,
158158
key as usize,
159-
Ordering::SeqCst,
160-
Ordering::SeqCst,
159+
Ordering::Release,
160+
Ordering::Acquire,
161161
) {
162162
// The CAS succeeded, so we've created the actual key
163163
Ok(_) => key as usize,

0 commit comments

Comments
 (0)