15 lines
276 B
Kotlin
15 lines
276 B
Kotlin
package app.extensions
|
|
|
|
import androidx.compose.runtime.Composable
|
|
import kotlinx.coroutines.sync.Semaphore
|
|
|
|
suspend inline fun Semaphore.acquireAndUse(
|
|
block: () -> Composable
|
|
) {
|
|
this.acquire()
|
|
try {
|
|
block()
|
|
} finally {
|
|
this.release()
|
|
}
|
|
} |