From 2a20d2458986f2312208b3ea7e912da8d88c6f6e Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 7 Sep 2023 16:57:59 +0600 Subject: [PATCH] fixes in SmartRWLocker --- CHANGELOG.md | 3 +++ .../kotlin/dev/inmo/micro_utils/coroutines/SmartRWLocker.kt | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fdd5d7a415..cb2b337d799 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## 0.20.5 +* `Coroutines`: + * Fixes in `SmartRWLocker` + ## 0.20.4 * `Versions`: diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/SmartRWLocker.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/SmartRWLocker.kt index e1a6e7eb694..7aaf845cb81 100644 --- a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/SmartRWLocker.kt +++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/SmartRWLocker.kt @@ -37,8 +37,8 @@ class SmartRWLocker(private val readPermits: Int = Int.MAX_VALUE, writeIsLocked: * Locking [writeMutex] and wait while all [readSemaphore] permits will be freed */ suspend fun lockWrite() { - _readSemaphore.acquire(readPermits) _writeMutex.lock() + _readSemaphore.acquire(readPermits) } /**