fix of tests

This commit is contained in:
2024-08-03 01:47:39 +06:00
parent 5fbc1a132f
commit bf293a8f8f
8 changed files with 93 additions and 19 deletions

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()
}
@@ -37,8 +38,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)
}
/**