Skip to content

Releases

CFFI

Choose a tag to compare

@cyberdelia cyberdelia released this 16 Mar 06:13

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.value

A 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.value

Due to the new underlying mechanism, values have to be integer otherwise a TypeError is raised.