mirror of https://github.com/smol-rs/parking
Compare commits
2 Commits
a7a5baad3e
...
952cb96a75
Author | SHA1 | Date |
---|---|---|
John Nunley | 952cb96a75 | |
John Nunley | 79d6b07f40 |
20
src/lib.rs
20
src/lib.rs
|
@ -59,24 +59,6 @@ use sync::atomic::AtomicUsize;
|
|||
use sync::atomic::Ordering::SeqCst;
|
||||
use sync::{Condvar, Mutex};
|
||||
|
||||
#[cfg(coverage)]
|
||||
#[coverage(off)]
|
||||
fn cov_assert(x: bool, msg: &str) {
|
||||
if !x {
|
||||
panic!("{}", msg);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(coverage))]
|
||||
use assert_eq as cov_assert_eq;
|
||||
|
||||
#[cfg(coverage)]
|
||||
macro_rules! cov_assert_eq {
|
||||
($left:expr, $right:expr, $msg:literal) => {{
|
||||
cov_assert($left == $right, $msg)
|
||||
}};
|
||||
}
|
||||
|
||||
/// Creates a parker and an associated unparker.
|
||||
///
|
||||
/// # Examples
|
||||
|
@ -372,7 +354,7 @@ impl Inner {
|
|||
// with that `unpark` to observe any writes it made before the call to `unpark`. To
|
||||
// do that we must read from the write it made to `state`.
|
||||
let old = self.state.swap(EMPTY, SeqCst);
|
||||
cov_assert_eq!(old, NOTIFIED, "park state changed unexpectedly");
|
||||
assert_eq!(old, NOTIFIED, "park state changed unexpectedly");
|
||||
return true;
|
||||
}
|
||||
Err(n) => panic!("inconsistent park_timeout state: {}", n),
|
||||
|
|
Loading…
Reference in New Issue