[Interest] QMap and thread-safe.

Sze Howe Koh szehowe.koh at gmail.com
Fri Jul 26 08:27:28 CEST 2013


On 26 July 2013 12:57, Mandeep Sandhu <mandeepsandhu.chd at gmail.com> wrote:
> On Thu, Jul 25, 2013 at 9:04 PM, Thiago Macieira <thiago.macieira at intel.com>
>> int inc(int &foo)
>> {
>>     return foo++; // not atomic anywhere
>
>
> Why? Because of the way foo is being received in this function, i.e by
> reference (so any operation on foo has and added level of indirection)?

Because that's simply a shorthand for 3 separate operations. See
http://stackoverflow.com/questions/10503737/is-increment-an-integer-atomic-in-x86


Regards,
Sze-Howe



More information about the Interest mailing list