Update comment

This commit is contained in:
Benoit Marty 2020-02-17 18:43:04 +01:00
parent 6d2025b61a
commit 141c7d6af0

View file

@ -20,7 +20,7 @@ import kotlinx.coroutines.sync.Semaphore
import kotlinx.coroutines.sync.withPermit import kotlinx.coroutines.sync.withPermit
/** /**
* This class intends to be used for ensure suspendable methods are played sequentially all the way long. * This class intends to be used to ensure suspendable methods are played sequentially all the way long.
*/ */
internal interface CoroutineSequencer { internal interface CoroutineSequencer {
/** /**
@ -32,7 +32,8 @@ internal interface CoroutineSequencer {
internal open class SemaphoreCoroutineSequencer : CoroutineSequencer { internal open class SemaphoreCoroutineSequencer : CoroutineSequencer {
private val semaphore = Semaphore(1) // Permits 1 suspend function at a time. // Permits 1 suspend function at a time.
private val semaphore = Semaphore(1)
override suspend fun <T> post(block: suspend () -> T): T { override suspend fun <T> post(block: suspend () -> T): T {
return semaphore.withPermit { return semaphore.withPermit {