-
Notifications
You must be signed in to change notification settings - Fork 631
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
Implements the waker changes for task API stabilization. #1445
Conversation
That's my current development snapshot. Requires rust-lang/rust#57992 to get merged. There's a ton of churn in this change, but most things are renaming. The important parts will be moving the Waker-related things over, e.g. inside LocalPool and the Compat adapter. |
@Matthias247 try running |
Thanks @Nemo157. If you want to review it, the main focus should be on components which involved Waker: |
@Matthias247 Any updates on this? Several other pending PRs can't pass CI and are blocked until this one gets merged. |
@ebkalderon From mv POV that's implemented. The checks were failing because it was never built by CI against the changes in std. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good to me (the Task
code reductions look great).
// For simplicity reasons wrap the Waker into an Arc. | ||
// We can optmize this again later on and reintroduce WakerLt<'a> which | ||
// derefs to Waker, and where cloning it through RawWakerVTable returns | ||
// an Arc version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you meant "optimize" here and not "optmize?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now cloning the current task twice on every single poll.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we'll want to follow up with this optimization pretty quickly since this will cause an allocation every time as_waker
is called :(
The CI failures seem to be related to the conflicting files after merging this with master. |
@Nemo157 I tried to resolve the conflicts in the web UI. If that won't work, I will only get to it tonight (PST). If you want to look into it before in order to unblock the library, feel free to merge and resolve it. Shouldn't be large issues. |
@Matthias247 Could you change the minimum required version on |
@taiki-e Thanks! That helped |
ea98f49
to
87b85e2
Compare
(Just a note, there are some minor EDIT: In order to make sure it's tested properly I'll do the fixes in a separate PR that also fixes #1396. |
@@ -27,20 +27,20 @@ fn unbounded_1_tx(b: &mut Bencher) { | |||
for i in 0..1000 { | |||
|
|||
// Poll, not ready, park | |||
assert_eq!(Poll::Pending, rx.poll_next_unpin(lw)); | |||
assert_eq!(Poll::Pending, rx.poll_next_unpin(waker)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: here and elsewhere, I think it'd be fine to abbreviate waker as e.g. wk
since it's used so often. I can open this as a separate followup change, though, since it seems potentially controversial.
This removes LocalWaker, and adds ArcWake to the library.
87b85e2
to
131c13f
Compare
I've gone ahead and rebased this and will merge when tests pass, and plan to follow up with some changes to cleanup a few issues that were brought up here before releasing. |
/// This macro bakes in propagation of `Err` signals by returning early. | ||
/// This macro bakes in propagation of `Pending` and `Err` signals by returning early. | ||
#[macro_export] | ||
macro_rules! try_poll { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Matthias247 Why was this macro removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 1339c87#diff-01958fc79efbf83fe4d83d5f9cb5b5ec, @cramertj replaced uses of try_poll!
with ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. Thanks for the response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, try_poll
is kinda useless now that ?
works on Poll
.
This removes LocalWaker, and adds ArcWake to the library.