skip to navigation
skip to content

Not Logged In

atomiclong 0.1.1

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.

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
 
File Type Py Version Uploaded on Size
atomiclong-0.1.1.tar.gz (md5) Source 2013-09-01 4KB
  • Downloads (All Versions):
  • 16 downloads in the last day
  • 74 downloads in the last week
  • 238 downloads in the last month