Re: __sync_fetch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 16, 2012 at 10:34 PM, Hei Chan <structurechart@xxxxxxxxx> wrote:
>
> 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?

The __sync primitives were designed by Intel.  I believe that they did
not include atomic load or store operators because on x86 processors
all aligned loads and stores are atomic.  Synchronization of loads and
stores with other processors on x86 requires the use of explicit
memory fence instructions.

Since GCC just picked up the Intel designed primitives, they work fine
on x86, but are deficient on other processors.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux