Closed fdischner closed 4 months ago
Very interesting, we talked about this before and I'm excited to see how well this works!
I pulled it in after some amount of testing. Seems to work here, though going to test a bit more on FPU based cortexes. Thanks!
The context switch is now always performed inside the PendSV handler, which greatly simplifies the code by reducing all switches to a single path. This should also eliminate any race conditions during the switch.
Because we always enter PendSV for a switch, there is a slight performance penalty in the case of switching from a non-preempted thread to another non-preempted thread (~40 cycles longer on an M4, compared to the previous implementation)