mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-27 00:00:12 +02:00
loom: remove StaticAtomicU64 (#7902)
This commit is contained in:
@@ -58,13 +58,6 @@ pub(crate) mod sync {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) use loom::sync::*;
|
pub(crate) use loom::sync::*;
|
||||||
|
|
||||||
pub(crate) mod atomic {
|
|
||||||
pub(crate) use loom::sync::atomic::*;
|
|
||||||
|
|
||||||
// TODO: implement a loom version
|
|
||||||
pub(crate) type StaticAtomicU64 = std::sync::atomic::AtomicU64;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) mod rand {
|
pub(crate) mod rand {
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ cfg_not_has_atomic_u64! {
|
|||||||
mod imp;
|
mod imp;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) use imp::{AtomicU64, StaticAtomicU64};
|
pub(crate) use imp::AtomicU64;
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ pub(crate) mod sync {
|
|||||||
pub(crate) mod atomic {
|
pub(crate) mod atomic {
|
||||||
pub(crate) use crate::loom::std::atomic_u16::AtomicU16;
|
pub(crate) use crate::loom::std::atomic_u16::AtomicU16;
|
||||||
pub(crate) use crate::loom::std::atomic_u32::AtomicU32;
|
pub(crate) use crate::loom::std::atomic_u32::AtomicU32;
|
||||||
pub(crate) use crate::loom::std::atomic_u64::{AtomicU64, StaticAtomicU64};
|
pub(crate) use crate::loom::std::atomic_u64::AtomicU64;
|
||||||
pub(crate) use crate::loom::std::atomic_usize::AtomicUsize;
|
pub(crate) use crate::loom::std::atomic_usize::AtomicUsize;
|
||||||
|
|
||||||
pub(crate) use std::sync::atomic::{fence, AtomicBool, AtomicPtr, AtomicU8, Ordering};
|
pub(crate) use std::sync::atomic::{fence, AtomicBool, AtomicPtr, AtomicU8, Ordering};
|
||||||
|
|||||||
@@ -67,16 +67,15 @@ impl fmt::Display for Id {
|
|||||||
|
|
||||||
impl Id {
|
impl Id {
|
||||||
pub(crate) fn next() -> Self {
|
pub(crate) fn next() -> Self {
|
||||||
use crate::loom::sync::atomic::Ordering::Relaxed;
|
use crate::loom::sync::atomic::{AtomicU64, Ordering::Relaxed};
|
||||||
use crate::loom::sync::atomic::StaticAtomicU64;
|
|
||||||
|
|
||||||
#[cfg(all(test, loom))]
|
#[cfg(all(test, loom))]
|
||||||
crate::loom::lazy_static! {
|
crate::loom::lazy_static! {
|
||||||
static ref NEXT_ID: StaticAtomicU64 = StaticAtomicU64::new(1);
|
static ref NEXT_ID: AtomicU64 = AtomicU64::new(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(all(test, loom)))]
|
#[cfg(not(all(test, loom)))]
|
||||||
static NEXT_ID: StaticAtomicU64 = StaticAtomicU64::new(1);
|
static NEXT_ID: AtomicU64 = AtomicU64::new(1);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let id = NEXT_ID.fetch_add(1, Relaxed);
|
let id = NEXT_ID.fetch_add(1, Relaxed);
|
||||||
|
|||||||
@@ -5,9 +5,15 @@ pub(crate) struct ThreadId(NonZeroU64);
|
|||||||
|
|
||||||
impl ThreadId {
|
impl ThreadId {
|
||||||
pub(crate) fn next() -> Self {
|
pub(crate) fn next() -> Self {
|
||||||
use crate::loom::sync::atomic::{Ordering::Relaxed, StaticAtomicU64};
|
use crate::loom::sync::atomic::{AtomicU64, Ordering::Relaxed};
|
||||||
|
|
||||||
static NEXT_ID: StaticAtomicU64 = StaticAtomicU64::new(0);
|
#[cfg(all(test, loom))]
|
||||||
|
crate::loom::lazy_static! {
|
||||||
|
static ref NEXT_ID: AtomicU64 = AtomicU64::new(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(all(test, loom)))]
|
||||||
|
static NEXT_ID: AtomicU64 = AtomicU64::new(0);
|
||||||
|
|
||||||
let mut last = NEXT_ID.load(Relaxed);
|
let mut last = NEXT_ID.load(Relaxed);
|
||||||
loop {
|
loop {
|
||||||
|
|||||||
Reference in New Issue
Block a user