mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-28 00:00:11 +02:00
Split tokio-threadpool lib.rs into files (#233)
* 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
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user