|
From: Jeroen N. W. [Bahco] <jn...@xs...> - 2009-07-24 17:01:55
|
Julian Seward wrote: > > Not really. On x86 and amd64, all atomic instructions are translated > using a loop, which fetches the old value, computes the new value, and > uses a compare-and-swap to either stuff the new value in, or detect that > the old value has changed, in which case it starts over. Do I read this correctly, and will the application being Valgrinded never observe a failing compare-and-swap? Just curious. :) Jeroen. |
|
From: Julian S. <js...@ac...> - 2009-07-24 19:53:37
|
On Friday 24 July 2009, Jeroen N. Witmond [Bahco] wrote: > Julian Seward wrote: > > Not really. On x86 and amd64, all atomic instructions are translated > > using a loop, which fetches the old value, computes the new value, and > > uses a compare-and-swap to either stuff the new value in, or detect that > > the old value has changed, in which case it starts over. > > Do I read this correctly, and will the application being Valgrinded never > observe a failing compare-and-swap? Just curious. :) Er, ok. What I wrote was a bit confusing. The description above is a way to translate atomic inc/dec/add etc using CAS. cmpxchg et al are simply translated using a CAS, with no loop. J |