Skip to content

reference counting API for python, modelled after the Linux Kernel's refcount_t.

License

Notifications You must be signed in to change notification settings

pmundt/pyrefcount

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyrefcount

GitHub Workflow Status MIT License PyPI - Python Version PyPI

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.

About

reference counting API for python, modelled after the Linux Kernel's refcount_t.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages