Quoting: website/main.rs at master · tokio-rs/website · GitHub
// The standard library provides low-level, unsafe APIs for defining wakers.
// Instead of writing unsafe code, we will use the helpers provided by the
// `futures` crate to define a waker that is able to schedule our `Task`
// structure.
impl ArcWake for Task {
fn wake_by_ref(arc_self: &Arc<Self>) {
// Schedule the task for execution. The executor receives from the
// channel and polls tasks.
let _ = arc_self.executor.send(arc_self.clone());
}
}
Does anyone have code for this unsafe wakers? My goal here is to drop the Arc, along with the Send+Sync requirement of ArcWake. (Not for production use; just for learning purposes.)