Le 4 oct. 09 à 09:35, Thiago Macieira a écrit : > Em Sábado 3. Outubro 2009, às 17.13.48, você escreveu: >> Can I use QAtomicInt as "an Int with basic operations being atomic": >> like getting, setting its value. Returning it from a function. >> If not, when and how can I use it. > > int is already atomic in those operations. > > QAtomicInt introduces new atomic operations: fetch-and-add, test-and- > set and > fetch-and-set. As for the memory ordering semantics, you had better > read a > book.
But native set and get operations do not ensure cache consistency among your processors (you are just guaranteed that, as long as your data are correctly aligned, you'll never read a partial result from another thread) while atomic fetch-and-add, test-and-set and fetch-and- set use a memory barrier (AFAIK, atomic integers are useless without memory barrier). -- Florent Bruneau _______________________________________________ Qt4-preview-feedback mailing list [email protected] http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback
