From ef95a223013a5350f4af6cd2ff61d7c8ff01e4cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20J=2E=20Saraiva?= Date: Tue, 7 Jan 2025 19:22:46 +0000 Subject: [PATCH] Use portable-atomic when AtomicU64 is not available. --- bb8/Cargo.toml | 3 +++ bb8/src/internals.rs | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bb8/Cargo.toml b/bb8/Cargo.toml index 8e8bcdd..d4f986d 100644 --- a/bb8/Cargo.toml +++ b/bb8/Cargo.toml @@ -14,6 +14,9 @@ futures-util = { version = "0.3.2", default-features = false, features = ["alloc parking_lot = { version = "0.12", optional = true } tokio = { version = "1.0", features = ["rt", "sync", "time"] } +[target.'cfg(not(target_has_atomic = "u64"))'.dependencies] +portable-atomic = "1" + [dev-dependencies] tokio = { version = "1.0", features = ["macros"] } diff --git a/bb8/src/internals.rs b/bb8/src/internals.rs index 7fdde3f..6bd8797 100644 --- a/bb8/src/internals.rs +++ b/bb8/src/internals.rs @@ -1,6 +1,10 @@ +#[cfg(not(target_has_atomic = "64"))] +use portable_atomic::AtomicU64; use std::cmp::min; use std::collections::VecDeque; -use std::sync::atomic::{AtomicU64, Ordering}; +#[cfg(target_has_atomic = "64")] +use std::sync::atomic::AtomicU64; +use std::sync::atomic::Ordering; use std::sync::Arc; use std::time::{Duration, Instant};