atomic-sequence-0.0.9
توضیحات
A lock-free, thread-safe sequence counter using the C++ atomic library.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | atomic-sequence-0.0.9 |
| نام | atomic-sequence |
| نسخه کتابخانه | 0.0.9 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Andriy Rossoshynskyy |
| ایمیل نویسنده | andriy.rossoshynskyy@gmail.com |
| آدرس صفحه اصلی | https://github.com/arossoshynskyy/atomic-sequence |
| آدرس اینترنتی | https://pypi.org/project/atomic-sequence/ |
| مجوز | - |
# Atomic Sequence
A lock-free, thread-safe sequence/counter which uses the C++ atomic library under the hood. This gives a ~5-10x speed up compared to threading locks.
## Install
```
pip install atomic-sequence
```
## Usage
```python
from atomicsequence import Sequence
sequence = AtomicSequence(0)
# set current sequence value to 1
sequence.set(1)
# get current value
value = sequence.get()
# increment the sequence value and get the new value
value = sequence.increment_and_get(1)
# increment the sequence value and get the value directly preceding the operation
value = sequence.get_and_increment(1)
```
## Testing
To run unittests and benchmarks use tox:
```
pipenv install --dev
pipenv run tox
```
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl atomic-sequence-0.0.9:
pip install atomic-sequence-0.0.9.whl
نصب پکیج tar.gz atomic-sequence-0.0.9:
pip install atomic-sequence-0.0.9.tar.gz