Re: GCC Atomic Operations

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

 



On 02/22/2010 09:00 PM, Peng Du wrote:

> I am using GCC Atomic operations, e.g. __sync_bool_compare_and_swap to
> do some low level sync stuff. I have the following questions: 
> 
> 1) are these SMP-safe on x86, i.e. will the result be visible to all
> CPUs after applying these functions? 

Yes: that's the whole idea.

> 2) otherwise, does it requires some sort of memory barrier/fence to
> flush the result? 
> 3) do I have to use "volatile" with atomic operations? 

Yes.

Andrew.

[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