Skip to main content

Python Version Pypi Version Code size in bytes

Upload Python Package

Coverage

License

RwLock: Reader-Writer lock

Introduction

We can simply protect a shared resource by a lock. But the performance is not good because each reader should run one-by-one.

A Reader-Writer lock can improve the performance by let readers running simultaneously.

By the way, a writer should wait until all readers done. In a frequently read situation, a new reader after the writer can also increase the read count, let read count never decrease to 0. This will starve writer.

RwLock:

  1. Let readers running simultaneously.
  2. Exclude "multiple readers" and each writer.
  3. provide a flag "write_first" to prevent starve writer.

After 1.6.0, RwLock can support multi-thread(default) and multi-process. For multi-process scenario, use rwlock = RwLock(cross_process=True)

Version control

  • cy-rwlock XX.YY.ZZ
    1. XX.YY match the latest git tag.
    2. ZZ will increase automatically when new commit appear in master branch.
    3. XX: Update when change architecture
    4. YY: Update when add or modify some features
    5. ZZ: Update when bugfix or minor changes.

Usage

Install

  1. pip install cy_rwlock
  2. download latest version from https://pypi.org/project/cy_rwlock/#files

Example


from rwlock import RwLock

rwlock = RwLock()

### READER
rwlock.acquire_r()
# read...
rwlock.release_r()

# OR
with rwlock.lock_r():
    # read...

### WRITER
rwlock.acquire_w()
# write...
rwlock.release_w()

# OR
with rwlock.lock_w():
    # write...

Unittest

  • local(windows)
    • run scripts\run.bat
  • github
    • auto run when push

Deploy

  • PyPI version
    • convertd from git tag
  • local(windows)
    • run scripts\deploy.bat
  • github -> PyPI
    • When release in github

Metadata

Release files for cy-rwlock 1.9.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 cy-rwlock 1.9.1
File Size Uploaded Provenance Actions
cy_rwlock-1.9.1.tar.gz 4.7 kB Without provenance Details for cy_rwlock-1.9.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cy-rwlock 1.9.1
File Interpreter ABI Platform Actions
cy_rwlock-1.9.1-py3-none-any.whl Python 3 none any Details for cy_rwlock-1.9.1-py3-none-any.whl

Total release size: 11.8 kB

Release files / cy_rwlock-1.9.1.tar.gz

Download URL cy_rwlock-1.9.1.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
55fa13c37839a05b6f201970442b28613f3bfd1ad9eef294598732fcec31bedd
BLAKE2b-256 checksum
How to use checksums
0a61a50a55f570da11945c8af6adcb6cabeab2bd097bbf5adee71ec7c6b9ab63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1

Release files / cy_rwlock-1.9.1-py3-none-any.whl

Download URL cy_rwlock-1.9.1-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
24e40c6967541125ccd1ebd9c61cb6232461ec74647fc78c66d34b23797f052e
BLAKE2b-256 checksum
How to use checksums
20af8e423a703e9cbfa16b138f7beebba84dd35b2d8de1896dfa631bc7eaa248
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1

Security for cy-rwlock 1.9.1

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.

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