Skip to content

Commit

Permalink
replace futures_task::ArcWake with std::task::Wake
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheyca authored and sdroege committed Jun 17, 2024
1 parent 6ff28b3 commit 53e4cab
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,14 @@ struct WakerProxy {
write_waker: task::AtomicWaker,
}

impl task::ArcWake for WakerProxy {
fn wake_by_ref(arc_self: &Arc<Self>) {
arc_self.read_waker.wake();
arc_self.write_waker.wake();
impl std::task::Wake for WakerProxy {
fn wake(self: Arc<Self>) {
self.wake_by_ref()
}

fn wake_by_ref(self: &Arc<Self>) {
self.read_waker.wake();
self.write_waker.wake();
}
}

Expand All @@ -125,8 +129,8 @@ where
#[cfg(feature = "verbose-logging")]
trace!("{}:{} AllowStd.with_context", file!(), line!());
let waker = match kind {
ContextWaker::Read => task::waker_ref(&self.read_waker_proxy),
ContextWaker::Write => task::waker_ref(&self.write_waker_proxy),
ContextWaker::Read => task::Waker::from(self.read_waker_proxy.clone()),
ContextWaker::Write => task::Waker::from(self.write_waker_proxy.clone()),
};
let mut context = task::Context::from_waker(&waker);
f(&mut context, Pin::new(&mut self.inner))
Expand Down

0 comments on commit 53e4cab

Please sign in to comment.