mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-16 00:00:12 +02:00
* Builder -> src/builder.rs * Callback -> src/callback.rs * Config -> src/config.rs * Futures2Wake -> src/futures2_wake.rs * Inner -> src/inner.rs * Notifier-> src/notifier.rs * Sender -> src/sender.rs * Shutdown -> src/shutdown.rs * ShutdownTask -> src/shutdown_task.rs * SleepStack -> src/sleep_stack.rs * State -> src/state.rs * ThreadPool -> src/thread_pool.rs * Worker -> src/worker.rs * WorkerEntry -> src/worker_entry.rs * WorkerState -> src/worker_state.rs
25 lines
510 B
Rust
25 lines
510 B
Rust
use futures::task::AtomicTask;
|
|
#[cfg(feature = "unstable-futures")]
|
|
use futures2;
|
|
|
|
#[derive(Debug)]
|
|
pub(crate) struct ShutdownTask {
|
|
pub task1: AtomicTask,
|
|
|
|
#[cfg(feature = "unstable-futures")]
|
|
pub task2: futures2::task::AtomicWaker,
|
|
}
|
|
|
|
impl ShutdownTask {
|
|
#[cfg(not(feature = "unstable-futures"))]
|
|
pub fn notify(&self) {
|
|
self.task1.notify();
|
|
}
|
|
|
|
#[cfg(feature = "unstable-futures")]
|
|
pub fn notify(&self) {
|
|
self.task1.notify();
|
|
self.task2.wake();
|
|
}
|
|
}
|