#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    16
    Rep Power
    0

    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?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2005
    Posts
    74
    Rep Power
    33
    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

IMN logo majestic logo threadwatch logo seochat tools logo