콘텐츠 메인 API - 코루틴 적용

This commit is contained in:
2023-11-07 16:47:25 +09:00
parent 0e786f46cb
commit ce15025c8d
5 changed files with 116 additions and 48 deletions

View File

@@ -0,0 +1,10 @@
package kr.co.vividnext.sodalive.common
import kotlinx.coroutines.sync.Semaphore
import kotlinx.coroutines.sync.withPermit
class SemaphoreManager(private val semaphore: Semaphore) {
suspend fun <T> withPermit(block: suspend () -> T): T {
return semaphore.withPermit { block() }
}
}