On Fri, Jul 26, 2013 at 12:30 PM, Thiago Macieira <[email protected] > wrote:
> On sexta-feira, 26 de julho de 2013 10:27:28, Mandeep Sandhu wrote: > > > Doing both at the same time is not atomic anywhere unless you use > > > specialised > > > fetch-and-add instructions, which the compiler never generates for you. > > > > By both here, you mean fetch AND add, right? > > Right > > > And in x86 such a operation > > (add) on a machine word is atomic w/o using special instructions? > > ADD is atomic, but usually an atomic increment is done with LOCK ADD, to > ensure that no other processor is trying to access the same memory > location. > The compiler will never generate a LOCK. > > In other words, ADD is atomic for single-CPU operations. As soon as there's > more than one CPU, it isn't enough. > Got it. Thanks for clearing this up! -mandeep
_______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
