use std::panic;
use std::panic::AssertUnwindSafe;
use std::task::Waker;
#[inline]
#[allow(dead_code)]
pub(crate) fn wake_all(mut wakers: impl Iterator<Item = Waker>) {
struct WakeRemaining<'a, I: Iterator<Item = Waker>> {
wakers: &'a mut I,
}
impl<I: Iterator<Item = Waker>> Drop for WakeRemaining<'_, I> {
fn drop(&mut self) {
for waker in self.wakers.by_ref() {
let _ = panic::catch_unwind(AssertUnwindSafe(|| waker.wake()));
}
}
}
let remaining = WakeRemaining {
wakers: &mut wakers,
};
for waker in remaining.wakers.by_ref() {
waker.wake();
}
}
#[cfg(feature = "mpsc")]
pub(crate) mod atomic_waker;
#[cfg(any(
feature = "barrier",
feature = "broadcast",
feature = "event",
feature = "completion",
feature = "latch",
feature = "mpsc",
feature = "mutex",
feature = "rwlock",
feature = "semaphore",
feature = "waitgroup",
feature = "watch",
))]
#[allow(dead_code)]
pub(crate) mod arena;
#[cfg(any(feature = "latch", feature = "once"))]
pub(crate) mod countdown;
#[cfg(any(feature = "lazy-cell", feature = "once-cell"))]
#[allow(dead_code)]
pub(crate) mod value_cell;
#[cfg(any(
feature = "barrier",
feature = "broadcast",
feature = "event",
feature = "completion",
feature = "latch",
feature = "mpsc",
feature = "mutex",
feature = "rwlock",
feature = "semaphore",
feature = "waitgroup",
feature = "watch",
))]
pub(crate) mod mutex;
#[cfg(any(
feature = "mpsc",
feature = "mutex",
feature = "rwlock",
feature = "semaphore",
))]
#[allow(dead_code)]
pub(crate) mod semaphore;
#[cfg(any(
feature = "event",
feature = "mpsc",
feature = "mutex",
feature = "rwlock",
feature = "semaphore",
))]
#[allow(dead_code)]
pub(crate) mod waitlist;
#[cfg(any(
feature = "barrier",
feature = "broadcast",
feature = "event",
feature = "completion",
feature = "latch",
feature = "mpsc",
feature = "mutex",
feature = "once",
feature = "rwlock",
feature = "semaphore",
feature = "waitgroup",
feature = "watch",
))]
#[allow(dead_code)]
pub(crate) mod waker_batch;
#[cfg(any(
feature = "barrier",
feature = "broadcast",
feature = "completion",
feature = "latch",
feature = "once",
feature = "waitgroup",
feature = "watch",
))]
#[allow(dead_code)]
pub(crate) mod wakerset;