I've written a sketch that usesTimer1 to create periodic CTC interrupts. I have an ISR(TIMER1_COMPA_vect) interrupt service routine that is called on each interrupt. It's all working well.
However, I have a couple uint32_t (unsigned long) variables shared between the ISR and the main loop. So I should probably protect access to these variables with the ATOMIC_BLOCK macro from the avr lib's util/atomic.h. But here is a concern. These macros work by using the cli() and sei() functions to clear and set the global interrupt flag during the protected block. If the next timer interrupt happens to come while in the middle of one of these blocks, will the interrupt be lost, or will it be deferred, held in a pending state, and fire as seen as the protected block ends and the global interrupt flag is turned on again?