↧
Answer by Craig Estey for Atomic 64 bit counter on ARM 32 bit MCU without locks
Just use stdatomic.h primitives.They will do the right thing for whatever arch.And, the code will be inlined [where possible].For arm, they might use ldrex. And they might use dmb for a memory barrier....
View ArticleAtomic 64 bit counter on ARM 32 bit MCU without locks
On a ARM Cortex M 32 bit, under C, I need to maintain a 64 bit counter. I want to avoid a race condition like:start: count = 0x00000000 ffffffffthreadA: increment count_low count = 0x00000000...
View Article