Skip to content

Commit

Permalink
Move multi_thread poll_start_callback to be directly before `task…
Browse files Browse the repository at this point in the history
….run`
  • Loading branch information
Jason Gin committed Jan 22, 2025
1 parent e5e0ead commit 8e034bb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tokio/src/runtime/scheduler/multi_thread/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,16 +588,16 @@ impl Context {
// purposes. These tasks inherent the "parent"'s limits.
core.stats.start_poll();

// Unlike the poll time above, poll start callback is attached to the task id,
// so it is tightly associated with the actual poll invocation.
#[cfg(tokio_unstable)]
self.worker.handle.task_hooks.poll_start_callback(task_id);

// Make the core available to the runtime context
*self.core.borrow_mut() = Some(core);

// Run the task
coop::budget(|| {
// Unlike the poll time above, poll start callback is attached to the task id,
// so it is tightly associated with the actual poll invocation.
#[cfg(tokio_unstable)]
self.worker.handle.task_hooks.poll_start_callback(task_id);

task.run();

#[cfg(tokio_unstable)]
Expand Down

0 comments on commit 8e034bb

Please sign in to comment.