SmartRWLocker now will wait first unlock of write mutex for acquiring read

This commit is contained in:
InsanusMokrassar 2023-10-26 12:28:24 +06:00
parent f6d0f72e49
commit 075b93ecd6
2 changed files with 4 additions and 0 deletions

View File

@ -2,6 +2,9 @@
## 0.20.11
* `Coroutines`:
* `SmartRWLocker` now will wait first unlock of write mutex for acquiring read
## 0.20.10
* `Versions`:

View File

@ -23,6 +23,7 @@ class SmartRWLocker(private val readPermits: Int = Int.MAX_VALUE, writeIsLocked:
* Do lock in [readSemaphore] inside of [writeMutex] locking
*/
suspend fun acquireRead() {
_writeMutex.waitUnlock()
_readSemaphore.acquire()
}