v2.0
[2.0] - 02.03.2026
Add highly optimized O(1) RWCondition and AsyncRWCondition primitives with flawless cancellation shielding. Also rename all *SafeWriter classes to *ReentrantWriter and expand test coverage for the v2.0 release.
Added
- Condition Variables for Thread & Async Environments:
- Introduced
RWCondition(Thread) andAsyncRWCondition(Asyncio) primitives. - Condition variables can now wrap any specific scheduling strategy (
Write-Pref,Read-Pref,FIFO, andReentrantvariants) via Dependency Injection. - Standard Condition's O(N) wake-up traversal has been completely bypassed.
RWConditionutilizes adequewith micro-locks, andAsyncRWConditionutilizes a nativedequeofasyncio.Futureobjects to provide pure O(1) time complexity forwait(),notify(), andnotify_all()operations.
- Introduced
- Condition Smart Proxies & Downgrade Safety:
- Implemented
.readand.writeproxies for Condition objects (RWConditionProxy,AsyncRWConditionProxy). - The Smart Proxy intelligently routes the release operations back to the correct state even if an Atomic Downgrade was performed while holding a lock inside a condition block.
- Implemented
- Flawless Cancellation Shielding (Asyncio):
- Re-engineered the
AsyncRWConditionProxy.wait()method to be absolutely resilient toasyncio.CancelledError. Tasks that are cancelled while sleeping now securely re-acquire the lock before throwing the error to prevent any state corruption.
- Re-engineered the
- Advanced Benchmark Suite for Conditions:
- Added comprehensive "Cache Stampede Simulators" (
PubSubScenario&ReaderWriterConditionScenario) to measure event loop queuing, task wake-up latency, and stampede protection. - Demonstrated up to 70x FASTER throughput compared to standard
asyncio.Conditionandthreading.Conditionin (1 Writer, 100 Readers) workloads.
- Added comprehensive "Cache Stampede Simulators" (
- Expanded Test Coverage:
- Test suite expanded from 135 to 252 unit tests.
- Added deep validation for state ownership,
notify(n)precision, lock release safety, and timeout precision on both synchronous and asynchronous Condition proxies.
Updated
- Reentrant Class Naming Convention:
- Renamed all
*SafeWriterclasses to*ReentrantWriter(e.g.,RWLockWriteSafeWriter->RWLockWriteReentrantWriter) to better reflect their strictly nested, reentrant nature in the software engineering domain.
- Renamed all
- Documentation & README:
- Added "Condition Memory vs CPU Trade-off" and "The Cost of Fairness" sections to the Architecture Limitations.
- Expanded usage examples to cover Event-Driven Cache Refreshes, Precise Job Queues, and Condition-Based Atomic Downgrading patterns.