Skip to main content

This is rwrlock a yet another python re-entrant rw lock

Goals

  • To make a rentrant read write lock as opposed to non re-entrant
  • Within one thread multiple readlocks can be obtained in reality only first in stack takes lock restreference count
  • Within onethreadmultiple write locks can be obtained again first gets lock restreference count
  • Within one thread if you want a read lock and have a write lock it acts as if read lock is obtained but keeps the write lock
  • Wihin one thread if you have a read lock and want a write lock read lock is dropped a write lock acquired. But when write is release the read lock is reobtained. This can lead to read consistency issues if not used carefuly.

This does not implement and priority between readers and writers

Usage:
            from rwrlock import RWRLock
            
            my_obj_rwlock = RWRLock()
            
            # When reading from my_obj:
            with my_obj_rwlock.r_locked():
                do_read_only_things_with(my_obj)
                    # promote to a write lock
                    with my_obj_rwlock.w_locked():
                        mutate(my_obj)
                
            # When writing to my_obj:
            with my_obj_rwlock.w_locked():
                mutate(my_obj)
                    # ok do to do read things as has a write lock
                    with my_obj_rwlock.r_locked():
                        do_read_only_things_with(my_obj)

Release files for rwrlock 0.0.5

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

Source distribution (sdist)

Source distribution for rwrlock 0.0.5
File Size Uploaded
rwrlock-0.0.5.tar.gz 7.4 kB Details

Built distribution (wheel)

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

Total release size: 16.9 kB

Release files / rwrlock-0.0.5.tar.gz

Download URL rwrlock-0.0.5.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
dd3400249cef04c08d938914d664a4f487d8050c627edfe66842137cb17617fc
BLAKE2b-256 checksum
How to use checksums
cd15a886aed8227f05f77e569cd6e8273bc137cd9adbbe8654c7bfb9a6e5ea59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.18.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.10

Release files / rwrlock-0.0.5-py3-none-any.whl

Download URL rwrlock-0.0.5-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00a18ad8628491be78fc77005aecdcb882baca1949e42964bcaa5e1824870a26
BLAKE2b-256 checksum
How to use checksums
eb4eb2261f9b32ab061b02bd8968a0e43014103e6b1d729cd76539d94ddfb681
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.18.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.10

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

1 release file

0.0.1

1 release file

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