AtomicLong
Sometimes you need to increment some numbers … atomically … in python.
AtomicLong was born out of the need for fast thread-safe counters in python.
It uses CFFI to bind GCC’s Atomic Builtins.
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.
Example:
>>> 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
Metadata
Release files for atomiclong 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| atomiclong-0.1.1.tar.gz | 5.1 kB | Details |
Release files / atomiclong-0.1.1.tar.gz
| Download URL | atomiclong-0.1.1.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cb1378c4cd676d6f243641c50e277504abf45f70f1ea76e446efcdbb69624bbe
|
|
BLAKE2b-256 checksum How to use checksums |
868c70aea8215c6ab990f2d91e7ec171787a41b7fbc83df32a067ba5d7f3324f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |