The Tokio executor is the part of the async runtime that drives futures toward completion. Creating a future does not run its computation: the executor must poll it. In a Tokio program, an async task can be spawned with `tokio::spawn`, awaited, and joined with other tasks. section 10.3
A future’s `poll` method returns `Poll::Ready(value)` when its result is available or `Poll::Pending` when it cannot finish yet. A pending task uses the `Waker` from its polling context to notify the runtime when it can make progress; the executor can then poll it again. Returning `Pending` without arranging a wake leaves the task unfinished, while waking it on every poll can produce repeated polling without progress. section 10.4 section 10.6
An expiration timer
A custom `Future` stores an expiration time. Its `poll` method returns `Ready` once that time has passed. Otherwise, it arranges for a sleeping thread to call the task’s waker and returns `Pending`. That lets the executor run another task before polling the timer again. The contrasting simulated timer calls `std::thread::sleep()` within its task. section 10.5
impl Future for ReadFileFuture {
type Output = String;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) ->
Poll<Self::Output> { #1
println!("Tokio! Stop polling me");
cx.waker().wake_by_ref(); #2
Poll::Pending
}
}
This `poll` implementation calls `wake_by_ref()` and immediately returns `Pending`; its repeated output shows why waking a task must be tied to actual progress. section 10.4


