mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +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.
|
/// All mutations must have happened before the unsynchronized load.
|
||||||
/// Additionally, there must be no concurrent mutations.
|
/// Additionally, there must be no concurrent mutations.
|
||||||
pub(crate) unsafe fn unsync_load(&self) -> u16 {
|
pub(crate) unsafe fn unsync_load(&self) -> u16 {
|
||||||
// See <https://github.com/tokio-rs/tokio/issues/6155>
|
core::ptr::read(self.inner.get() as *const u16)
|
||||||
self.load(std::sync::atomic::Ordering::Relaxed)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,8 +26,7 @@ impl AtomicU32 {
|
|||||||
/// All mutations must have happened before the unsynchronized load.
|
/// All mutations must have happened before the unsynchronized load.
|
||||||
/// Additionally, there must be no concurrent mutations.
|
/// Additionally, there must be no concurrent mutations.
|
||||||
pub(crate) unsafe fn unsync_load(&self) -> u32 {
|
pub(crate) unsafe fn unsync_load(&self) -> u32 {
|
||||||
// See <https://github.com/tokio-rs/tokio/issues/6155>
|
core::ptr::read(self.inner.get() as *const u32)
|
||||||
self.load(std::sync::atomic::Ordering::Relaxed)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,8 +26,7 @@ impl AtomicUsize {
|
|||||||
/// All mutations must have happened before the unsynchronized load.
|
/// All mutations must have happened before the unsynchronized load.
|
||||||
/// Additionally, there must be no concurrent mutations.
|
/// Additionally, there must be no concurrent mutations.
|
||||||
pub(crate) unsafe fn unsync_load(&self) -> usize {
|
pub(crate) unsafe fn unsync_load(&self) -> usize {
|
||||||
// See <https://github.com/tokio-rs/tokio/issues/6155>
|
core::ptr::read(self.inner.get() as *const usize)
|
||||||
self.load(std::sync::atomic::Ordering::Relaxed)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn with_mut<R>(&mut self, f: impl FnOnce(&mut usize) -> R) -> R {
|
pub(crate) fn with_mut<R>(&mut self, f: impl FnOnce(&mut usize) -> R) -> R {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user