SeqCst->{Release,Acquire} in sys_common::thread_local_key.

SeqCst is unnecessary here.
This commit is contained in:
Mara Bos
2024-03-19 15:03:29 +01:00
parent 516684c22e
commit e43aef0ef9

View File

@@ -128,7 +128,7 @@ impl StaticKey {
#[inline] #[inline]
unsafe fn key(&self) -> imp::Key { unsafe fn key(&self) -> imp::Key {
match self.key.load(Ordering::Relaxed) { match self.key.load(Ordering::Acquire) {
KEY_SENTVAL => self.lazy_init() as imp::Key, KEY_SENTVAL => self.lazy_init() as imp::Key,
n => n as imp::Key, n => n as imp::Key,
} }
@@ -156,8 +156,8 @@ impl StaticKey {
match self.key.compare_exchange( match self.key.compare_exchange(
KEY_SENTVAL, KEY_SENTVAL,
key as usize, key as usize,
Ordering::SeqCst, Ordering::Release,
Ordering::SeqCst, Ordering::Acquire,
) { ) {
// The CAS succeeded, so we've created the actual key // The CAS succeeded, so we've created the actual key
Ok(_) => key as usize, Ok(_) => key as usize,