Skip to content

Commit

Permalink
m: Rename modules
Browse files Browse the repository at this point in the history
Since `std.rs` and `no_std.rs` no longer correspond to std and no_std,
I've renamed them based on the underlying algorithm used. `std.rs` is
now `intrusive.rs`, since it uses an intrusive linked list. `no_std.rs`
is now `slab.rs`, since it relies on a structure similar to the one used
in the `slab` crate.

Signed-off-by: John Nunley <[email protected]>
  • Loading branch information
notgull committed Nov 17, 2024
1 parent 0f7fe93 commit be58b66
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/std.rs → src/intrusive.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! libstd-based implementation of `event-listener`.
//! Intrusive linked list-based implementation of `event-listener`.
//!
//! This implementation crates an intrusive linked list of listeners. This list
//! is secured using either a libstd mutex or a critical section.
Expand Down Expand Up @@ -362,7 +362,7 @@ impl<T> DerefMut for ListLock<'_, '_, T> {
#[cfg(all(feature = "std", not(feature = "critical-section")))]
impl<T> Drop for ListLock<'_, '_, T> {
fn drop(&mut self) {
update_notified(&self.inner.notified, &mut self.lock);
update_notified(&self.inner.notified, &self.lock);
}
}

Expand Down
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ extern crate alloc;
#[cfg(feature = "std")]
extern crate std as alloc;

#[cfg_attr(any(feature = "std", feature = "critical-section"), path = "std.rs")]
#[cfg_attr(
any(feature = "std", feature = "critical-section"),
path = "intrusive.rs"
)]
#[cfg_attr(
not(any(feature = "std", feature = "critical-section")),
path = "no_std.rs"
path = "slab.rs"
)]
mod sys;

Expand Down
2 changes: 1 addition & 1 deletion src/no_std.rs → src/slab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//! atomic queue if the lock is contended. Benchmarks show that this is about 20% slower than the std
//! implementation, but still much faster than using a queue.
#[path = "no_std/node.rs"]
#[path = "slab/node.rs"]
mod node;

use node::{Node, NothingProducer, TaskWaiting};
Expand Down
File renamed without changes.

0 comments on commit be58b66

Please sign in to comment.