Skip to content

Commit d4cc41e

Browse files
committed
Use portable-atomic when necessary.
1 parent 60d969f commit d4cc41e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/pool/arc.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,15 @@ use core::{
7272
hash::{Hash, Hasher},
7373
mem::{ManuallyDrop, MaybeUninit},
7474
ops, ptr,
75-
sync::atomic::{self, AtomicUsize, Ordering},
7675
};
7776

77+
#[cfg(not(feature = "portable-atomic"))]
78+
use core::sync::atomic;
79+
#[cfg(feature = "portable-atomic")]
80+
use portable_atomic as atomic;
81+
82+
use atomic::{AtomicUsize, Ordering};
83+
7884
use super::treiber::{NonNullPtr, Stack, UnionNode};
7985

8086
/// Creates a new `ArcPool` singleton with the given `$name` that manages the specified `$data_type`

src/pool/treiber/cas.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
use core::{marker::PhantomData, ptr::NonNull, sync::atomic::Ordering};
1+
use core::{marker::PhantomData, ptr::NonNull};
22

33
#[cfg(not(feature = "portable-atomic"))]
44
use core::sync::atomic;
55
#[cfg(feature = "portable-atomic")]
66
use portable_atomic as atomic;
77

8+
use atomic::Ordering;
9+
810
use super::{Node, Stack};
911

1012
#[cfg(target_pointer_width = "32")]

0 commit comments

Comments
 (0)