Jump virtual time to the earliest outstanding timer and wake it. The executor calls this when there are no runnable tasks left. Instead of incrementing time in wall-clock steps, simulation time jumps directly to the minimum timer deadline. Returns `false` if there are no timers to wake.
(&self)
| 66 | /// directly to the minimum timer deadline. Returns `false` if there are no |
| 67 | /// timers to wake. |
| 68 | pub fn wake_next_timer(&self) -> bool { |
| 69 | let wakers = { |
| 70 | let mut state = self.inner.lock(); |
| 71 | let Some(next_deadline) = state.timers.values().map(|timer| timer.deadline).min() else { |
| 72 | return false; |
| 73 | }; |
| 74 | if next_deadline > state.now { |
| 75 | state.now = next_deadline; |
| 76 | } |
| 77 | state.take_due_wakers() |
| 78 | }; |
| 79 | let woke = !wakers.is_empty(); |
| 80 | wake_all(wakers); |
| 81 | woke |
| 82 | } |
| 83 | |
| 84 | /// Register or refresh a timer entry for a sleeping future. |
| 85 | /// |