atomic accesses
Andrew Haley
aph@redhat.com
Tue Mar 4 16:37:00 GMT 2008
Paul Koning wrote:
> I'm really wondering why this is being considered.
>
> A documented property of the form "GCC will use a single instruction
> to do X when possible" means exactly nothing. In particular, to call
> such a statement a "guarantee" is seriously misleading.
I agree.
> If Linux needs the single-instruction property for atomicity, and it
> thinks it can rely on this supposed property, then Linux has a bug.
> To do atomic operations, you have to use primitives that are
> guaranteed always to have the necessary atomicity properties.
Yes.
> 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.
Andrew.
More information about the Gcc
mailing list