An AtomicLong type using CFFI.
Sometimes you need to increment some numbers … atomically … in python.
AtomicLong was born out of the need for fast thread-safe counters in python.
Its value is a C long which can be incremented, decremented, and set atomically. It is inspired by Java’s java.util.concurrent.atomic.AtomicLong.
>>> from atomiclong import AtomicLong >>> a = AtomicLong(0) >>> a += 1 >>> a.value 1 >>> a += 10 >>> a.value 11 >>> a.value = 1000 >>> a.value 1000 >>> a -= 100 >>> a.value 900
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size atomiclong-0.1.1.tar.gz (5.1 kB)||File type Source||Python version None||Upload date||Hashes View|