Step 1-Improving our runtime design by adding a Reactor and a Waker 189 Important note Our Waker relies on calling park/unpark on the Thread type from the standard library. This is OK for our example since it's easy to understand, but given that any part of the code (including any libraries you use) can get a handle to the same thread by calling std::thread::current() and call park/unpark on it, it's not a robust solution. If unrelated parts of the code call park/unpark on the same thread, we can miss wakeups or end up in deadlocks. Most production libraries create their own Parker type or rely on something such as crossbeam::sync::Parker (https://docs. rs/crossbeam/ latest/crossbeam/sync/struct. Parker. html ) instead. We won't implement Waker as a trait since passing trait objects around will significantly increase the complexity of our example, and it's not in line with the current design of Future and Waker in Rust either. Open the executor. rs file located inside the runtime folder, and let's add all the imports we're going to need right from the start: ch08/b-reactor-executor/src/runtime/executor. rs use crate::future::{Future, Poll State}; use std::{ cell::{Cell, Ref Cell}, collections::Hash Map, sync::{Arc, Mutex}, thread::{self, Thread}, }; The next thing we add is our Waker : ch08/b-reactor-executor/src/runtime/executor. rs #[derive(Clone)] pub struct Waker { thread: Thread, id: usize, ready_queue: Arc<Mutex<Vec<usize>>>, } The Waker will hold three things for us: thread -A handle to the Thread object we mentioned earlier. id-An usize that identifies which task this Waker is associated with.