Exclusive and shared locking
Project description
Intro
The SELock is a shared/exclusive lock that you can use to coordinate read and write access to a resource in a multithreaded application.
- Example:
use SELock to coordinate access to a resource
>>> from scottbrian_locking import se_lock as sel >>> a_lock = sel.SELock() >>> # Get lock in exclusive mode >>> with sel.SELockExcl(a_lock): ... msg = 'lock obtained exclusive' >>> print(msg) lock obtained exclusive
>>> # Get lock in shared mode >>> with sel.SELockShare(a_lock): ... msg = 'lock obtained shared' >>> print(msg) lock obtained shared
Installation
Windows:
pip install scottbrian-locking
Development setup
See tox.ini
Release History
- 1.0.0
Initial release
- 1.1.0
Add RELockObtain context manager
support python 3.11
- 2.0.0
Add obtain_tf to context manager
Add allow_recursive_obtain
Delete setup.cfg
Make consistent log and error messages
Support python 3.12
Drop support for python < 3.12
- 2.0.1
- Fix documentation
change docs/source/index.rst
change docs/requirements.txt
change readthedoc.yml
- 2.0.2
Fix verify_lock to refresh lock_info
Fix thread name in release granted log message
- 2.1.0
Support python 3.13
Meta
Scott Tuttle
Distributed under the MIT license. See LICENSE for more information.
Contributing
Fork it (<https://github.com/yourname/yourproject/fork>)
Create your feature branch (git checkout -b feature/fooBar)
Commit your changes (git commit -am ‘Add some fooBar’)
Push to the branch (git push origin feature/fooBar)
Create a new Pull Request
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scottbrian_locking-2.1.0.tar.gz.
File metadata
- Download URL: scottbrian_locking-2.1.0.tar.gz
- Upload date:
- Size: 37.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb3b764f2f48f9a49df0d94899bd054214dd1f6ae31cfe62cd90ca0808d341c3
|
|
| MD5 |
160f8315028ea0b0d7e69feadc4714b4
|
|
| BLAKE2b-256 |
40db7eeae0ae7dba8e07e8a0b0b8fee38fb0effb0ea2e1d175a8913a0d2e20d4
|
File details
Details for the file scottbrian_locking-2.1.0-py3-none-any.whl.
File metadata
- Download URL: scottbrian_locking-2.1.0-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53bde7bb95ba3c661f635f003e2a7d2c5dc9735bdc4c4821e73a4d62d3914bf0
|
|
| MD5 |
27401dde0b2ad851df42071d88d809ad
|
|
| BLAKE2b-256 |
f79bdff369fabbcb04af0c954b1c641b4418624a90709eca21d3eb1c1e3d3de8
|