Skip to content

Commit

Permalink
Merge pull request #6 from asynchronics/feature/loom-as-dev-dep
Browse files Browse the repository at this point in the history
Update Loom and make it a dev dependency
  • Loading branch information
sbarral authored Sep 8, 2024
2 parents ae33b47 + b1c890c commit fa29533
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ pin-project-lite = "0.2"
tokio = { version = "1.0", features = ["full"] }
futures-executor = "0.3"

[target.'cfg(async_event_loom)'.dependencies]
loom = "0.5"

[target.'cfg(async_event_loom)'.dev-dependencies]
loom = "0.7"
waker-fn = "1.1"

[lints.rust]
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ impl WaitSet {
unsafe fn insert(&self, notifier: NonNull<Notifier>) {
let mut list = self.list.lock().unwrap();

#[cfg(any(debug_assertions, async_event_loom))]
#[cfg(any(debug_assertions, all(test, async_event_loom)))]
if notifier.as_ref().in_wait_set.load(Ordering::Relaxed) {
drop(list); // avoids poisoning the lock
panic!("the notifier was already in the wait set");
Expand Down
6 changes: 3 additions & 3 deletions src/loom_exports.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[cfg(async_event_loom)]
#[cfg(all(test, async_event_loom))]
#[allow(unused_imports)]
pub(crate) mod sync {
pub(crate) use loom::sync::Mutex;
Expand All @@ -7,7 +7,7 @@ pub(crate) mod sync {
pub(crate) use loom::sync::atomic::{fence, AtomicBool};
}
}
#[cfg(not(async_event_loom))]
#[cfg(not(all(test, async_event_loom)))]
#[allow(unused_imports)]
pub(crate) mod sync {
pub(crate) use std::sync::Mutex;
Expand Down Expand Up @@ -51,7 +51,7 @@ pub(crate) mod sync {
pub(crate) mod cell {
pub(crate) use loom::cell::UnsafeCell;
}
#[cfg(not(async_event_loom))]
#[cfg(not(all(test, async_event_loom)))]
pub(crate) mod cell {
#[derive(Debug)]
pub(crate) struct UnsafeCell<T>(std::cell::UnsafeCell<T>);
Expand Down

0 comments on commit fa29533

Please sign in to comment.