재개

suspend fun main() {
    println("Before")
    println("After")
}
// Before
// After
suspend fun main() {
    println("Before")
    suspendCoroutine<Unit> {  }
    println("After")
}
// Before
@InlineOnly
public suspend inline fun <T> suspendCoroutine(crossinline block: (Continuation<T>) -> Unit): T {
    contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
    return suspendCoroutineUninterceptedOrReturn { c: Continuation<T> ->
        val safe = SafeContinuation(c.intercepted())
        block(safe)
        safe.getOrThrow()
    }
}
suspend fun main() {
    println("Before")
    suspendCoroutine<Unit> { continuation ->
        println("Before too") // 실행 후 중단.
    }
    println("After")
}
// Before
// Before too