Skip to content

Commit

Permalink
📝 refine schedule_global
Browse files Browse the repository at this point in the history
  • Loading branch information
Xudong-Huang committed Sep 5, 2024
1 parent cc20ac9 commit e83d7e8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ impl Scheduler {
let thread_id = NEXT_THREAD_ID
.fetch_add(1, Ordering::Relaxed)
.rem_euclid(self.workers);
self.schedule_global_with_id(co, thread_id)
let global = unsafe { self.global_queues.get_unchecked(thread_id) };
global.push(co);
// signal one waiting thread if any
self.get_selector().wakeup(thread_id);
}

/// put the coroutine to global queue so that next time it can be scheduled
Expand Down

0 comments on commit e83d7e8

Please sign in to comment.