First time poster here, let me know if this should be posted elsewhere. Please be kind :p.
This question came to me on a hike, and I couldn't find exactly what I was looking for afterwards.
Suppose I have an ISR for an event. Normally, the event will fire the interrupt, the ISR will run, and then we'll continue on our merry way.
Suppose now I have some shared variables, and as a super simple fix, I globally disable interrupts during the critical section. If the event occurs during this critical section, does the ISR execute after I re-enable interrupts or is that event never handled?
Furthermore, what would happen if an event was to occur inside the ISR, after the interrupt flag has been cleared but before the ISR finishes? If it happens multiple times, does only the first one that occurred within the ISR get handled?
Appreciate all answers. Typically I keep my ISRs short enough that this hasn't happened yet.
Thanks!