is +=1 thread safe
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Fri May 2 02:56:59 EDT 2008
On Thu, 01 May 2008 15:33:09 -0700, Gary Herron wrote:
> Of course it's not thread safe. For the same reason and more basic,
> even the expression i++ is not thread safe in C++.
>
> Any such calculation, on modern processors, requires three operations:
> retrieve value of i into a register,
> increment the register
> write the value into i.
There are no modern processors with an opcode for incrementing a memory
location!? At least my C64 can do that. ;-)
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list