mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-28 12:10:37 +00:00
chore: use unsync loads for unsync_load
(#7073)
This reverts #6203 and #6179.
This commit is contained in:
parent
67f127769b
commit
e8f39157b6
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user