Skip to content

Commit

Permalink
instrument local schedules in basic scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
carllerche committed Jan 5, 2022
1 parent 3075fc7 commit 60c7152
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tokio/src/runtime/basic_scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,11 @@ impl Schedule for Arc<Shared> {
fn schedule(&self, task: task::Notified<Self>) {
CURRENT.with(|maybe_cx| match maybe_cx {
Some(cx) if Arc::ptr_eq(self, &cx.spawner.shared) => {
cx.core
.borrow_mut()
.as_mut()
.expect("core missing")
.tasks
.push_back(task);
let mut core = cx.core.borrow_mut();
let core = core.as_mut().expect("core missing");

core.stats.inc_local_schedule_count();
core.tasks.push_back(task);
}
_ => {
// Track that a task was scheduled from **outside** of the runtime.
Expand Down

0 comments on commit 60c7152

Please sign in to comment.