Skip to content

Commit e8f3915

Browse files
authored
chore: use unsync loads for unsync_load (#7073)
This reverts #6203 and #6179.
1 parent 67f1277 commit e8f3915

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

tokio/src/loom/std/atomic_u16.rs

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

tokio/src/loom/std/atomic_u32.rs

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

tokio/src/loom/std/atomic_usize.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ impl AtomicUsize {
2626
/// All mutations must have happened before the unsynchronized load.
2727
/// Additionally, there must be no concurrent mutations.
2828
pub(crate) unsafe fn unsync_load(&self) -> usize {
29-
// See <https://github.com/tokio-rs/tokio/issues/6155>
30-
self.load(std::sync::atomic::Ordering::Relaxed)
29+
core::ptr::read(self.inner.get() as *const usize)
3130
}
3231

3332
pub(crate) fn with_mut<R>(&mut self, f: impl FnOnce(&mut usize) -> R) -> R {

0 commit comments

Comments
 (0)