fuookami.ospf.kotlin.utils.parallel.ChannelGuard.kt Maven / Gradle / Ivy
package fuookami.ospf.kotlin.utils.parallel
import kotlinx.coroutines.channels.*
class ChannelGuard(
val channel: Channel
) : AutoCloseable {
override fun close() {
channel.close()
}
operator fun iterator() = channel.iterator()
suspend fun receive() = channel.receive()
fun tryReceive() = channel.tryReceive()
}