Metadata-Version: 2.4
Name: atomiclong
Version: 0.1.1
Summary: An AtomicLong type using CFFI.
Home-page: https://github.com/dreid/atomiclong
Author: David Reid
Author-email: dreid@dreid.org
License: MIT
License-File: LICENSE
Requires-Dist: cffi
Dynamic: author
Dynamic: author-email
Dynamic: description
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: summary

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`_.

It's 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


.. _GCC's Atomic Builtins: http://gcc.gnu.org/onlinedocs/gcc-4.3.5/gcc/Atomic-Builtins.html

.. _CFFI: https://cffi.readthedocs.org

.. _java.util.concurrent.atomic.AtomicLong: http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/AtomicLong.html
