Just wondered if the above is true or whether reference assignments are split into two operations
Is this the reason you need to use Interlocked.Exchange
?
Can anyone confirm?
I am talking about pointer assignment here - Is that truly atomic?
It depends on the type. For example Int64 assignments are not atomic in x86 mode and atomic in x64 mode. Assigning a string
is atomic as it is a reference type and you are assigning a pointer and the size of the pointer is either 4 or 8 bytes depending on whether you are running on x86 or x64 bit mode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With