ru.hnau.jutils.producer.locked_producer.SuspendLockedProducer.kt Maven / Gradle / Ivy
package ru.hnau.jutils.producer.locked_producer
class SuspendLockedProducer : CalcLockedProducer() {
suspend fun executeLocked(block: suspend () -> T): T {
return try {
incLockedCount()
block.invoke()
} finally {
decLockedCount()
}
}
}