diff options
Diffstat (limited to 'embassy-executor/src')
| -rw-r--r-- | embassy-executor/src/arch/riscv32.rs | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/embassy-executor/src/arch/riscv32.rs b/embassy-executor/src/arch/riscv32.rs index 2a4b006da..76eb8b114 100644 --- a/embassy-executor/src/arch/riscv32.rs +++ b/embassy-executor/src/arch/riscv32.rs | |||
| @@ -55,19 +55,11 @@ impl Executor { | |||
| 55 | unsafe { | 55 | unsafe { |
| 56 | self.inner.poll(); | 56 | self.inner.poll(); |
| 57 | // we do not care about race conditions between the load and store operations, interrupts | 57 | // we do not care about race conditions between the load and store operations, interrupts |
| 58 | //will only set this value to true. | 58 | // will only set this value to true. |
| 59 | critical_section::with(|_| { | 59 | // if there is work to do, loop back to polling |
| 60 | // if there is work to do, loop back to polling | 60 | if !SIGNAL_WORK_THREAD_MODE.fetch_and(false, Ordering::SeqCst) { |
| 61 | // TODO can we relax this? | 61 | core::arch::asm!("wfi"); |
| 62 | if SIGNAL_WORK_THREAD_MODE.load(Ordering::SeqCst) { | 62 | } |
| 63 | SIGNAL_WORK_THREAD_MODE.store(false, Ordering::SeqCst); | ||
| 64 | } | ||
| 65 | // if not, wait for interrupt | ||
| 66 | else { | ||
| 67 | core::arch::asm!("wfi"); | ||
| 68 | } | ||
| 69 | }); | ||
| 70 | // if an interrupt occurred while waiting, it will be serviced here | ||
| 71 | } | 63 | } |
| 72 | } | 64 | } |
| 73 | } | 65 | } |
