v.20.4Improvement

Update RWLock with Timeout Parameter and Phase Fair Implementation

Update to RWLock: timeout parameter for getLock() + implementation reworked to be phase fair #10073 (Alexander Kazakov)
RWLock update with timeout support and phase fair locking implementation.

Why it matters

This feature introduces a timeout parameter to the getLock() method of RWLock (read-write lock) and reworks the locking mechanism to be phase fair. It solves issues related to potential starvation and unfair lock acquisition order by ensuring a more balanced and predictable lock granting process, improving concurrency behavior and performance in multi-threaded environments.

How to use it

Users can specify a timeout when calling the getLock() method on an RWLock instance to limit how long a thread waits to acquire the lock. The underlying locking mechanism now uses a phase fair algorithm automatically, requiring no additional configuration.