R
raphfrk
Does this make all read/writes happen in full.
For example, if one thread had
volatile long a = 0xFFFFFFFF00000000L;
<do stuff>
a = ~a;
If another thread read a, would it always give 0xFFFFFFFF00000000 or
0x00000000FFFFFFFF and not partial writes (say it updates 32 bits and
then the next 32 bits).
I understand that if two threads do a++, it might only increment
twice, if they both read the old value at the same time.
Effectively, does the CPU lock the entire 64-bits for the long when
doing the write update, and so other threads either seen the updated
value or the old value?
For example, if one thread had
volatile long a = 0xFFFFFFFF00000000L;
<do stuff>
a = ~a;
If another thread read a, would it always give 0xFFFFFFFF00000000 or
0x00000000FFFFFFFF and not partial writes (say it updates 32 bits and
then the next 32 bits).
I understand that if two threads do a++, it might only increment
twice, if they both read the old value at the same time.
Effectively, does the CPU lock the entire 64-bits for the long when
doing the write update, and so other threads either seen the updated
value or the old value?