In 32-bit ARM, the function above will be compiled into
ldr r2, [pc,
str r0, [r2] ; store value into globalFloat
Since there are 2 instructions, the CPU is free to do anything between them, but only the second instruction str r0, [r2]affects the memory. If globalFloatnot aligned, the CPU can perform atomic recording with one copy.
, . , , . CGRect.
. - . OSMemoryBarrier() "" .
, (, globalFloat += value). OSAtomic.