Hi, After searching more for info, it seems like even though on a 64-bit machine, reading a long (i.e. 8 bytes) is one operation, it might not give the "correct" value: http://gcc.gnu.org/ml/gcc/2008-03/msg00201.html And so, we have to use __sync_fetch_and_add(&x, 0) to read? Could someone elaborate a situation that reading a long variable won't get the correct value given that all writes in the application use __sync_fetch_*()? Thanks in advance. Cheers, Hei ________________________________ From: Hei Chan <structurechart@xxxxxxxxx> To: "gcc-help@xxxxxxxxxxx" <gcc-help@xxxxxxxxxxx> Sent: Friday, November 16, 2012 10:34 PM Subject: __sync_fetch Hi, I am using GCC 4.1.2, and so no __atomic*(). I am looking at http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Atomic-Builtins.html I see __sync_fetch_and_*(), but I don't see __sync_fetch(). Is it because the built-in routines support integral scalar or pointer type that is up to 8 bytes in length, and so the read is automatically atomic anyway? Thanks in advance. Cheers, Hei