Closed edwardalee closed 2 years ago
The problem with this solution is not just coarse timing, but there are certain functions that need to be called in reactions that need for interrupts to be enabled. An example is in the library reactor src/lib/IMU.lf
, which now has a (dangerous) temporary workaround pending the right fix with critical sections. The IMU.lf
reactor enables interrupts, makes a blocking call to read I/O, then disables interrupts. This opens up the possibility of another ISR getting invoked and the event queue getting corrupted, so this needs to be fixed soon.
PR #11 gave us a stopgap solution towards enabling interrupt service routines to call
lf_schedule
by disabling all application interrupts except during calls tonanosleep
. But this may lead to excessively coarse timing. It would be better if the unthreaded runtime of reactor-c supported "critical sections" and this lf-buckler repo provided an implementation that disables interrupts. See https://github.com/lf-lang/reactor-c/issues/104