Readers / writers file lock helper class
Project description
Readers / writers file lock Python helper class
This library was created in order to ease the synchronization of several processes using shared resources, like a caching directory or a SQLite database. All of them can use the resources, but only one should update them.
The library is being used in several INB projects.
Example of a shared lock using context:
import datetime
import os
import time
from RWFileLock import RWFileLock
lock = RWFileLock("/tmp/rwfilelock.lock")
with lock.shared_lock():
print(
f"[{datetime.datetime.now().isoformat()}] Got shlock {os.getpid()}"
)
time.sleep(7)
print(
f"[{datetime.datetime.now().isoformat()}] Releasing shlock {os.getpid()}"
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
RWFileLock-0.2.2.tar.gz
(13.1 kB
view hashes)
Built Distribution
RWFileLock-0.2.2-py3-none-any.whl
(14.4 kB
view hashes)
Close
Hashes for RWFileLock-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24d60c9192021c6fad19b5163849188bbc20df9e01a519f130431f60a5751c36 |
|
MD5 | 0552a115d9837324a17e94f47987513a |
|
BLAKE2b-256 | 5f2bd1caae8b2de44b6cec5416e01cc3c6a09fa24263b02f7b0372e2dbed681c |