If I do not call
What is the effect of
ATOMIC_BLOCK()? The documentation seems to imply they are only relevant if one makes that call first. My understanding is that timers, for example, are always handled in a separate thread which would make these functions still useful if one was trying to coordinate multiple timers.
Adding on to that, if I am manipulating a piece of data that may also be changed in a
ISR in the main
loop, what is the best way to protect those accesses assuming I am not making a call first to
SYSTEM_THREAD(ENABLED)? It seems like making a call to
ATOMIC_BLOCK would be safest, since it ensures an interrupt will not come along and mangle the data before it is finished processing.