Coroutines

thread vs coroutine

Demo

Kotlin Coroutines - suspend

suspend fun fetchRecord()

suspend fun processRecord(record: Record)

suspend fun doIt(){
  val record = fetchRecord()
  processRecord(record)
}
interface Continuation<in T> {
    val context: CoroutineContext
    fun <T> resume(value: T): Unit
    fun <T> resumeWithException(exception: Throwable): Unit
}

Scopes, builders, etc.

Channel

Coroutines

By Krzysztof Folwarczny

Coroutines

  • 202