Merge remote-tracking branch 'upstream/scheduler_wake_when_defer_pending' into integration

This commit is contained in:
J. Nick Koston
2026-04-24 03:37:51 -05:00
+6
View File
@@ -423,6 +423,12 @@ optional<uint32_t> HOT Scheduler::next_schedule_in(uint32_t now) {
// iteration has work to do right now -- don't let the caller sleep.
if (!this->defer_empty_())
return 0;
#else
// On single-threaded builds, defer() routes through set_timeout(..., 0) which
// stages in to_add_. process_to_add() runs at the top of every scheduler.call(),
// so anything in to_add_ becomes runnable on the next iteration; don't sleep.
if (!this->to_add_empty_())
return 0;
#endif
// If no items, return empty optional