Skip to main content

A lock-free, thread-safe sequence counter using the C++ atomic library.

Project description

Atomic Sequence

A lock-free sequence which uses the C++ atomic library under the hood. This gives a ~3.5x speed increase over using python locks


The packge can be installed the usual way using

python install


from atomic import Sequence

sequence = Sequence(0)

# set current sequence value to 1
# get current value
value = sequence.get()
# increment the sequence value and get the new value
value = sequence.increment_and_get(1)
# increment the sequence value and get the value directly preceding the operation
value = sequence.get_and_increment(1)


To run unittests and benchmarks use tox:

pipenv run tox

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for atomic-sequence, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size atomic-sequence-0.0.1.tar.gz (416.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page