mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-12-18 14:47:15 +00:00
SmartRWLocker now will wait first unlock of write mutex for acquiring read
This commit is contained in:
parent
f6d0f72e49
commit
075b93ecd6
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
## 0.20.11
|
## 0.20.11
|
||||||
|
|
||||||
|
* `Coroutines`:
|
||||||
|
* `SmartRWLocker` now will wait first unlock of write mutex for acquiring read
|
||||||
|
|
||||||
## 0.20.10
|
## 0.20.10
|
||||||
|
|
||||||
* `Versions`:
|
* `Versions`:
|
||||||
|
@ -23,6 +23,7 @@ class SmartRWLocker(private val readPermits: Int = Int.MAX_VALUE, writeIsLocked:
|
|||||||
* Do lock in [readSemaphore] inside of [writeMutex] locking
|
* Do lock in [readSemaphore] inside of [writeMutex] locking
|
||||||
*/
|
*/
|
||||||
suspend fun acquireRead() {
|
suspend fun acquireRead() {
|
||||||
|
_writeMutex.waitUnlock()
|
||||||
_readSemaphore.acquire()
|
_readSemaphore.acquire()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user