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
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
File details
Details for the file scottbrian_locking-2.0.2.tar.gz
.
File metadata
- Download URL: scottbrian_locking-2.0.2.tar.gz
- Upload date:
- Size: 37.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44a889cbb5e4b4e1a3b7e2ddd5498c7307cb97f808848a9ab29f7946569904ab |
|
MD5 | 90ac3d57475cfb6fbe240f31ccdd0405 |
|
BLAKE2b-256 | bfd0810001e96b2008df9a8931ce029888946b6ff03eec7b127ddbc3f0aa9c42 |
File details
Details for the file scottbrian_locking-2.0.2-py3-none-any.whl
.
File metadata
- Download URL: scottbrian_locking-2.0.2-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c0fc449f1e33af513411ca990a89f866a478449fc9f1bb64880cdc1be5688e1 |
|
MD5 | 39909ac3f2d94948af7622f14cb455f3 |
|
BLAKE2b-256 | 5a970359b2a44ce1ee64b267c8987ecdac390778c2448781c29929ecf8797444 |