Shared LockΒΆ
While not the primary focus of the library, Door also offer implementations of read-preferring and write-preferring shared locks (readers-writer locks).
The read-preferring implementations in this library follow the pseudocode in Concurrent Programming: Algorithms, Principles, and Foundations by Michel Raynal.
The usual acquire/release interface as modelled by
door.primitives.Acquirable is not sufficient to describe the
functionalities of shared locks. Therefore, for
door.primitives.SAcquirable, we expand the interface as follows:
acquire-readrelease-readacquire-writerelease-write
We offer implementations for both synchronous and asynchronous programming. These classes of shared locks are available, for different use cases:
Read-preferring:
door.threading2.RSLockfor multithreading.door.multiprocessing2.RSLockfor multiprocessing.door.asyncio2.RSLockfor asynchronous programming.
Write-preferring:
door.threading2.WSLockfor multithreading.door.multiprocessing2.WSLockfor multiprocessing.door.asyncio2.WSLockfor asynchronous programming.