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 @@ pub unsafe fn set(&self, val: *mut u8) {
#[inline]
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,
n => n as imp::Key,
}
@ -156,8 +156,8 @@ unsafe fn lazy_init(&self) -> usize {
match self.key.compare_exchange(
KEY_SENTVAL,
key as usize,
Ordering::SeqCst,
Ordering::SeqCst,
Ordering::Release,
Ordering::Acquire,
) {
// The CAS succeeded, so we've created the actual key
Ok(_) => key as usize,