On Tue, Mar 4, 2008 at 7:31 PM, David Daney <[EMAIL PROTECTED]> wrote: > Jakub Jelinek wrote: > > On Tue, Mar 04, 2008 at 04:37:29PM +0000, Andrew Haley wrote: > >>> Typically those would be found in asm statements. > >>> I suspect it would be valuable to have standardized primitives for > >>> atomic actions (semaphores, spinlocks, test-and-set primitives, > >>> circular buffers, pick one). > >> We already have these in gcc, and they're even documented. > > > > We don't have atomic read or atomic write builtins (ok, you could > > abuse __sync_fetch_and_add (&x, 0) for atomic read and a loop > > with __sync_compare_and_swap_val for atomic store, but that's a horrible > > overkill. > > There is nothing preventing us from adding __sync_fetch and __sync_store > so that we could avoid the overkill. > > Perhaps anything declared volatile should have these semantics. > Although mentioning 'volatile' on the lkml is probably not a good idea.
Certainly not. volatile has nothing to do with atomic access. Richard.