Repository navigation
Releases
Releases · cyberdelia/atomic
CFFI
Warning: This new version is not backward compatible with previous ones.
The C extension is no more, replaced by a less clunky cffi implementation.
The new C code use the fairly recent atomic built-in functions introduced in gcc >= 4.7.
The new API allows a more expressive way to increments or decrement values:
from atomic import AtomicLong
atomic = AtomicLong(0)
atomic += 1
atomic.valueA new AtomicLongArray is also introduced that allows you to have an array of AtomicLong, only direct assignation is atomic for now. The implementation will hopefully allows more useful use cases in the future.
from atomic import AtomicLongArray
atomic = AtomicLongArray([0, 2])
atomic.valueDue to the new underlying mechanism, values have to be integer otherwise a TypeError is raised.