mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-05 16:19:41 +00:00
SmartRWLocker now will wait first unlock of write mutex for acquiring read
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
|
||||
## 0.20.11
|
||||
|
||||
* `Coroutines`:
|
||||
* `SmartRWLocker` now will wait first unlock of write mutex for acquiring read
|
||||
|
||||
## 0.20.10
|
||||
|
||||
* `Versions`:
|
||||
|
@@ -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()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user