A
Alexandru Mosoi
how can i do an atomic read+increment? something like
with lock:
old = atomic_int
atomic_int += 1
but in one operation
with lock:
old = atomic_int
atomic_int += 1
but in one operation
Alexandru said: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
Frank Millman said:Just out of interest, would the following, without a lock, be safe?
old, atomic_int = atomic_int, atomic_int+1
Frank said:Just out of interest, would the following, without a lock, be safe?
old, atomic_int = atomic_int, atomic_int+1
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.