Skip to content

Commit 74519c8

Browse files
authored
Use portable-atomic when AtomicU64 is not available (#233)
1 parent 6e2a586 commit 74519c8

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

bb8/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ futures-util = { version = "0.3.2", default-features = false, features = ["alloc
1414
parking_lot = { version = "0.12", optional = true }
1515
tokio = { version = "1.0", features = ["rt", "sync", "time"] }
1616

17+
[target.'cfg(not(target_has_atomic = "u64"))'.dependencies]
18+
portable-atomic = "1"
19+
1720
[dev-dependencies]
1821
tokio = { version = "1.0", features = ["macros"] }
1922

bb8/src/internals.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
use std::cmp::min;
22
use std::collections::VecDeque;
3-
use std::sync::atomic::{AtomicU64, Ordering};
3+
#[cfg(target_has_atomic = "64")]
4+
use std::sync::atomic::AtomicU64;
5+
use std::sync::atomic::Ordering;
46
use std::sync::Arc;
57
use std::time::{Duration, Instant};
68

9+
#[cfg(not(target_has_atomic = "64"))]
10+
use portable_atomic::AtomicU64;
711
use tokio::sync::Notify;
812

913
use crate::api::{Builder, ManageConnection, QueueStrategy, State, Statistics};

0 commit comments

Comments
 (0)