-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add owner id for tasks in OwnedTasks #3979
Conversation
// the runtime has fully shut down. | ||
// | ||
// The assert below is unrelated to this mutex. | ||
drop(remote_queue); |
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.
What is the reason to remove this?
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.
It was never necessary to hold the mutex locked for this long in the first place. It was introduced in #3752.
for task in self.context.tasks.borrow_mut().queue.drain(..) { | ||
task.shutdown(); | ||
drop(task); |
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 was changed a bunch of places. I don't see a drop impl added on the type? Why is this changed?
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.
The type in question is Notified
, and it already has a destructor. I changed it because otherwise you need to go through assert_owner
to call shutdown
. The call to shutdown
has been unnecessary since #3955, as the inject queue and similar can no longer hold newly spawned tasks.
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.
Left some notes inline. Looks good, mostly nits. I had one question re: changing task.shutdown()
to a drop.
This change makes
OwnedTasks::remove
safe and guarantees that non-Send tasks are not polled on the wrong thread.