atomic increment

Diez B. Roggisch deets at nospam.web.de
Tue Aug 26 17:56:13 CEST 2008


Alexandru  Mosoi wrote:

> how can i do an atomic read+increment? something like
> 
> with lock:
>    old = atomic_int
>    atomic_int += 1
> 
> but in one operation

As above - the lock (under the assumption that it is actually a
threading.Lock) will ensure that.

Diez



More information about the Python-list mailing list