Skip to main content

py-rwmutex

This package provides a simple read/write mutex lock for threads, based upon the threading package. It supports Python's context manager interface, so it may be used within with statements.

Purpose

This read/write lock can improve performance by allowing multiple threads to reaad from a shared resource at once. For safety, only one thread is granted a write lock at a time, and only when no threads have a read lock.

Installation

This package is available from PyPi, which means it can be easily acquired via pip.

Run this command at a shell prompt:

pip3 install rwmutex

Usage

To get started, import the package like so:

from rwmutex import RWLock

Then you can declare a lock object:

lock = RWLock()

To use the lock, you can use with blocks:

with lock.write
    # some operation that writes
    pass

with lock.read:
    # some operation that just needs to read
    pass

For a working example, see example.py.

Metadata

Release files for rwmutex 1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rwmutex 1.1
File Size Uploaded
rwmutex-1.1.tar.gz 2.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rwmutex 1.1
File Interpreter ABI Platform
rwmutex-1.1-py3-none-any.whl Python 3 none any Details

Total release size: 5.4 kB

Release files / rwmutex-1.1.tar.gz

Download URL rwmutex-1.1.tar.gz
Size 2.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b8fdc87810aa6b0b7b4c02c1612cc66141e91bd45bad8556e3305cdc2123d393
BLAKE2b-256 checksum
How to use checksums
7bd7bbbdf48e9f55189533337adfcfa9fa3211a9dab9a1122dca5f0dc22ccc5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.3

Release files / rwmutex-1.1-py3-none-any.whl

Download URL rwmutex-1.1-py3-none-any.whl
Size 3.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
69a8256ccbd0e061fc8c14892d8d2b3b64d8d8c7b8e6f1abbd607c5147cfb6c7
BLAKE2b-256 checksum
How to use checksums
139ba1105cb2e6a67d9019563c3240da6a2111112a092799c31ce0017d527f70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.3

Release history Release notifications | RSS feed

This release

1.1 This release

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page