Nope... it guarantees direct memory access but not atomic operation (You would get atomic operation if that was a byte). Because we are on a 8 bit architecture, an assignment over 4 bytes will require a number of memory access to move the 4 bytes to the destination. You could be interrupted in the middle of those moves by the timer handling millis() and Murphy guarantees it will ![]()
Yes, I meant something like MicroBahner proposed to guarantee that timer0_millis = youCannot is done atomically.
void setMillis(unsigned long youCannot)
{
uint8_t oldSREG = SREG;
cli();
timer0_millis = youCannot;
SREG = oldSREG;
}