Skip to content

Commit

Permalink
Use portable-atomic sync primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed Sep 26, 2024
1 parent 1c16349 commit f7e1cf1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ license.workspace = true

[features]
default = ["std"]
std = ["alloc"]
std = ["alloc", "portable-atomic/std"]
alloc = []
bench = []
test_local = []

[dependencies]
crossbeam-utils = { version = "0.8", default-features = false }
portable-atomic = "1"

[dev-dependencies]
once_mut = "0.1.0"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Lock-free SPSC FIFO ring buffer with direct access to inner data.
+ Different types of buffers and underlying storages.
+ Can be used without `std` and even without `alloc` (using only statically-allocated memory).
+ Async and blocking versions (see [this section](#derived-crates)).
+ Uses the `portable-atomic` crate to allow usage on smaller systems without CAS operations.

# Usage

Expand Down
2 changes: 1 addition & 1 deletion src/rb/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ use core::{
mem::{ManuallyDrop, MaybeUninit},
num::NonZeroUsize,
ptr,
sync::atomic::{AtomicBool, AtomicUsize, Ordering},
};
use crossbeam_utils::CachePadded;
use portable_atomic::{AtomicBool, AtomicUsize, Ordering};

/// Ring buffer that can be shared between threads.
///
Expand Down

0 comments on commit f7e1cf1

Please sign in to comment.