On Sat, May 7, 2011 at 9:24 PM, Bakul Shah <ba...@bitblocks.com> wrote: > On Sat, 07 May 2011 20:25:25 EDT erik quanstrom <quans...@quanstro.net> > wrote: >> > > the difference, and my main point is that the loop in ainc means >> > > that it is not a wait-free algorithm. this is not only sub optimal, >> > > but also could lead to incorrect behavior. >> > >> > I think a more likely possibility for the change is to have a >> > *copy* of what was incremented. lock incl 0(ax) won't tell you >> > what the value was when it was incremented. >> >> you can read the code. that value is not used by the thread library. > > If you want to use the value being atomically incremented, > there is no more efficient way on x86. May not be used now but > may be it can be used to make some synchronization primitive > more efficient?
XADD -- vs