chore: use unsync loads for unsync_load (#7073)

This reverts #6203 and #6179.
This commit is contained in:
Alice Ryhl 2025-01-06 14:16:15 +01:00 committed by GitHub
parent 67f127769b
commit e8f39157b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 6 deletions

View File

@ -26,8 +26,7 @@ impl AtomicU16 {
/// All mutations must have happened before the unsynchronized load.
/// Additionally, there must be no concurrent mutations.
pub(crate) unsafe fn unsync_load(&self) -> u16 {
// See <https://github.com/tokio-rs/tokio/issues/6155>
self.load(std::sync::atomic::Ordering::Relaxed)
core::ptr::read(self.inner.get() as *const u16)
}
}

View File

@ -26,8 +26,7 @@ impl AtomicU32 {
/// All mutations must have happened before the unsynchronized load.
/// Additionally, there must be no concurrent mutations.
pub(crate) unsafe fn unsync_load(&self) -> u32 {
// See <https://github.com/tokio-rs/tokio/issues/6155>
self.load(std::sync::atomic::Ordering::Relaxed)
core::ptr::read(self.inner.get() as *const u32)
}
}

View File

@ -26,8 +26,7 @@ impl AtomicUsize {
/// All mutations must have happened before the unsynchronized load.
/// Additionally, there must be no concurrent mutations.
pub(crate) unsafe fn unsync_load(&self) -> usize {
// See <https://github.com/tokio-rs/tokio/issues/6155>
self.load(std::sync::atomic::Ordering::Relaxed)
core::ptr::read(self.inner.get() as *const usize)
}
pub(crate) fn with_mut<R>(&mut self, f: impl FnOnce(&mut usize) -> R) -> R {