Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace futures_task::ArcWake with std::task::Wake #134

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
// read waker slot for this, but any would do.
//
// Don't ever use this from multiple tasks at the same time!
pub(crate) trait SetWaker {

Check warning on line 52 in src/compat.rs

View workflow job for this annotation

GitHub Actions / Test (stable)

trait `SetWaker` is never used

Check warning on line 52 in src/compat.rs

View workflow job for this annotation

GitHub Actions / Test (beta)

trait `SetWaker` is never used

Check warning on line 52 in src/compat.rs

View workflow job for this annotation

GitHub Actions / Test (nightly)

trait `SetWaker` is never used
fn set_waker(&self, waker: &task::Waker);
}

Expand Down Expand Up @@ -107,10 +107,14 @@
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 @@
#[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
Loading