Commit aa51fb9
committed
fix(wait): call
It's necessary to call `unlock_cpu_and_check_preemption` after waking up
a task. For timed wake-ups, there are two possible places to do this:
1. The timeout callback function `interrupt_task_by_timeout` (defined
in `wait.rs`). However, `unlock_cpu_and_check_preemption` takes the
ownership of CPU Lock and the convention of timeout callback
functions requires that they enter and leave with CPU Lock active,
so this function would have to re-acquire CPU Lock before returning.
2. The tick handler, `handle_tick` (defined in `timeout.rs`). It
already releases CPU Lock, so this option doesn't have the CPU Lock
issue. This option may cause redundant calls to
`unlock_cpu_and_check_preemption`, but those won't happen too often
because timeout objects are expected to be used to wake up tasks for
most of the times.
This commit implements the second option.unlock_cpu_and_check_preemption after timeout expiration1 parent daae12e commit aa51fb9
1 file changed
+13
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
138 | 139 | | |
139 | 140 | | |
140 | 141 | | |
| |||
339 | 340 | | |
340 | 341 | | |
341 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
342 | 351 | | |
343 | 352 | | |
344 | 353 | | |
| |||
716 | 725 | | |
717 | 726 | | |
718 | 727 | | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
719 | 732 | | |
720 | 733 | | |
721 | 734 | | |
| |||
0 commit comments