File tree 1 file changed +9
-0
lines changed
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -66,8 +66,11 @@ impl Executor {
66
66
let waker =
67
67
unsafe { Waker :: from_raw ( RawWaker :: new ( & ready as * const _ as * const _ , & VTABLE ) ) } ;
68
68
let val = loop {
69
+ let mut task_woken = false ;
70
+
69
71
// advance the main task
70
72
if ready. load ( Ordering :: Acquire ) {
73
+ task_woken = true ;
71
74
ready. store ( false , Ordering :: Release ) ;
72
75
73
76
let mut cx = Context :: from_waker ( & waker) ;
@@ -88,6 +91,7 @@ impl Executor {
88
91
// "oneshot": they'll issue a `wake` and then disable themselves to not run again
89
92
// until the woken task has made more work
90
93
if task. ready . load ( Ordering :: Acquire ) {
94
+ task_woken = true ;
91
95
92
96
// we are about to service the task so switch the `ready` flag to `false`
93
97
task. ready . store ( false , Ordering :: Release ) ;
@@ -109,6 +113,11 @@ impl Executor {
109
113
}
110
114
}
111
115
116
+ if task_woken {
117
+ // If at least one task was woken up, do not sleep, try again
118
+ continue ;
119
+ }
120
+
112
121
// try to sleep; this will be a no-op if any of the previous tasks generated a SEV or an
113
122
// interrupt ran (regardless of whether it generated a wake-up or not)
114
123
asm:: wfe ( ) ;
You can’t perform that action at this time.
0 commit comments