loto : Lockout-Tagout
Loto provides a simple decorator for functions that need to access critical sections with mutex locks.
When you decorate a function with @LockoutTagout(tag),
the function call will block until it can acquire a mutex lock
shared between all functions with the same tag.
Example
from loto import LockoutTagout
from threading import Thread
from random import random
from time import sleep
data = [1, 2, 3]
@LockoutTagout('data1')
def readData1(sharedData):
for val in sharedData:
print(val)
sleep(random())
@LockoutTagout('data1')
def writeData1(sharedData):
for i in range(0, 3):
sharedData[i] += 1
sleep(random())
for i in range(0, 5):
Thread(target=readData1, args=(data,)).start()
Thread(target=writeData1, args=(data,)).start()
These two functions will lockout-tagout with the same tag, so they will acquire a lock managed by this decorator class before they're executed. This means that no two functions with the same tag can be executing concurrently.
One mutex lock is managed per unique tag.
Installation
You can install this module from PyPI with
pip install loto
Metadata
Release files for loto 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| loto-0.1.5.tar.gz | 2.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| loto-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.2 kB
Release files / loto-0.1.5.tar.gz
| Download URL | loto-0.1.5.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
605ceb33136ed002179362ea7653ffeee422208a8da399546be165abb8c51470
|
|
BLAKE2b-256 checksum How to use checksums |
31edf4ef2968888f1ffa41eed7bee8e090d2122f9f3c622342b2e1ebfbf9ab4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3
|
Release files / loto-0.1.5-py3-none-any.whl
| Download URL | loto-0.1.5-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8cc11527ab765864c8203f3f9aa57b3ee3e6fe0bd7e35b4d833b96a0aa7cf028
|
|
BLAKE2b-256 checksum How to use checksums |
0be65ae9d6988d627dcf4c87c8d5b649426f2722c71a22a8292041ac9c89659b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3
|
Security for loto 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.