What happens if an interrupt (which could I presume call __pender) occurs right after they are enabled, but right before the executor goes to sleep? (see code comments).
I believe the thread could not wake up until there is another interrupt, which could be an arbitrary amount of time in the future.
Nevermind, I have read the avr docs, and understood that sei (interrupt enable) guarantees that the next instruction is executed before an interrupt can occur.
For the record, I was reading the code to try to understand how it works, and I may be totally wrong. I am no async/threading expert.
For the AVR arch, the
Executor
implementation looks like this:What happens if an interrupt (which could I presume call
__pender
) occurs right after they are enabled, but right before the executor goes to sleep? (see code comments).I believe the thread could not wake up until there is another interrupt, which could be an arbitrary amount of time in the future.
Line Link: https://github.com/embassy-rs/embassy/blob/10c9fbcc99b564d8ece88b32835dbc78a4269b34/embassy-executor/src/arch/avr.rs#L62