April 21st, 2013, 04:34 AM
Which of the following is an atomic operation?
(a) temp = temp + 1;
(b) X = temp;
(c) int temp = X;
I read somewhere that assignment operation are atomic. Incremental operation is not. So I conclude that (c) is atomic. Am I right?
April 26th, 2013, 06:47 PM
I think they all are. According to this, reads & writes are atomic apart from on longs and doubles. This is because they're held in 64 bits and each 32 bit 'portion' may be written seperately.
The disclaimer for the above is that I'm certainly not 100% and I've had a beer