W3cubDocs

/Kotlin

createCoroutineUnchecked

fun <T> (suspend () -> T).createCoroutineUnchecked(
    completion: Continuation<T>
): Continuation<Unit>

Platform and version requirements: Kotlin 1.1

Creates a coroutine without receiver and with result type T. This function creates a new, fresh instance of suspendable computation every time it is invoked.

To start executing the created coroutine, invoke resume(Unit) on the returned Continuation instance. The completion continuation is invoked when coroutine completes with result or exception.

This function is unchecked. Repeated invocation of any resume function on the resulting continuation corrupts the state machine of the coroutine and may result in arbitrary behaviour or exception.

fun <R, T> (suspend R.() -> T).createCoroutineUnchecked(
    receiver: R, 
    completion: Continuation<T>
): Continuation<Unit>

Platform and version requirements: Kotlin 1.1

Creates a coroutine with receiver type R and result type T. This function creates a new, fresh instance of suspendable computation every time it is invoked.

To start executing the created coroutine, invoke resume(Unit) on the returned Continuation instance. The completion continuation is invoked when coroutine completes with result or exception.

This function is unchecked. Repeated invocation of any resume function on the resulting continuation corrupts the state machine of the coroutine and may result in arbitrary behaviour or exception.

© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines.experimental.intrinsics/create-coroutine-unchecked.html