Re: [linux-audio-dev] atomic xchg

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] atomic xchg
From: Thomas Sailer (sailer_AT_ife.ee.ethz.ch)
Date: to loka   14 1999 - 07:27:11 EDT


Paul Barton-Davis wrote:
>
> can someone point me to a gcc asm macro to do atomic pointer swaps ?

This is unportable, but on x86 it would probably look like: (for 32bit
quantities)

asm("xchg %1,%0" : "=r" (a), "=m" (b) : "0" (a), "1" (b));

b is the memory operand. You cannot swap atomically two memory operands.

Tom


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:27:59 EST