Skip to main content

No project description provided

Project description

pyrefcount provides a simple API for reference counting, providing protected access to reference counted values, and for allowing acquire/release actions to be carried out when a reference count becomes active, or the last user drops off, respectively. pyrefcount is inspired by the Linux Kernel’s refcount_t API.

Usage

Usage of pyrefcount is straightforward:

>>> from refcount import Refcounter
>>> ref = Refcounter()
>>> ref.inc()
>>> ref.usecount
2
>>> ref.dec()
>>> if ref.dec_and_test():
...     print('refcount is now 0, do something here')

For more complex usage examples and a complete API reference, refer to the package documentation.

Features and Bugs

Please file feature requests and bug reports in the issue tracker.

License

pyrefcount is licensed under the MIT license.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page