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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It depends on the type. For example Int64 assignments are not atomic in x86 mode and atomic in x64 mode. Assigning a
stringis 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.