Package kotlin.coroutines.experimental
Deprecated support for experimental coroutines, provided for compatibility.
It's recommended to migrate to kotlin.coroutines
API.
Types
AbstractCoroutineContextElement
Base class for CoroutineContext.Element implementations.
abstract class AbstractCoroutineContextElement : Element
Continuation
Interface representing a continuation after a suspension point that returns value of type T
.
interface Continuation<in T>
ContinuationInterceptor
Marks coroutine context element that intercepts coroutine continuations. The coroutines framework uses ContinuationInterceptor.Key to retrieve the interceptor and intercepts all coroutine continuations with interceptContinuation invocations.
interface ContinuationInterceptor : Element
EmptyCoroutineContext
An empty coroutine context.
object EmptyCoroutineContext : CoroutineContext
Annotations
RestrictsSuspension
Classes and interfaces marked with this annotation are restricted when used as receivers for extension
suspend
functions. These suspend
extensions can only invoke other member or extension suspend
functions on this particular
receiver only and are restricted from calling arbitrary suspension functions.
annotation class RestrictsSuspension
Properties
coroutineContext
Continuation context of current coroutine.
suspend val coroutineContext: CoroutineContext
Functions
buildIterator
Builds an Iterator lazily yielding values one by one.
fun <T> buildIterator(
builderAction: suspend SequenceBuilder<T>.() -> Unit
): Iterator<T>
buildSequence
Builds a Sequence lazily yielding values one by one.
fun <T> buildSequence(
builderAction: suspend SequenceBuilder<T>.() -> Unit
): Sequence<T>
createCoroutine
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.
fun <R, T> (suspend R.() -> T).createCoroutine(
receiver: R,
completion: Continuation<T>
): Continuation<Unit>
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.
fun <T> (suspend () -> T).createCoroutine(
completion: Continuation<T>
): Continuation<Unit>
startCoroutine
Starts coroutine with receiver type R and result type T. This function creates and start a new, fresh instance of suspendable computation every time it is invoked. The completion continuation is invoked when coroutine completes with result or exception.
fun <R, T> (suspend R.() -> T).startCoroutine(
receiver: R,
completion: Continuation<T>)
Starts coroutine without receiver and with result type T. This function creates and start a new, fresh instance of suspendable computation every time it is invoked. The completion continuation is invoked when coroutine completes with result or exception.
fun <T> (suspend () -> T).startCoroutine(
completion: Continuation<T>)
suspendCoroutine
Obtains the current continuation instance inside suspend functions and suspends currently running coroutine.
suspend fun <T> suspendCoroutine(
block: (Continuation<T>) -> Unit
): T