Package kotlin. coroutines
Basic primitives for creating and suspending coroutines: Continuation, CoroutineContext interfaces, coroutine creation and suspension top-level functions.
Basic primitives for creating and suspending coroutines: Continuation, CoroutineContext interfaces, coroutine creation and suspension top-level functions.
Types
Base class for CoroutineContext.Element implementations.
Since Kotlin
Base class for CoroutineContext.Key associated with polymorphic CoroutineContext.Element implementation. Polymorphic element implementation implies delegating its get and minusKey to getPolymorphicElement and minusPolymorphicKey respectively.
Since Kotlin
Interface representing a continuation after a suspension point that returns a value of type T
.
Since Kotlin
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.
Since Kotlin
An empty coroutine context.
Since Kotlin
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 and are restricted from calling arbitrary suspension functions.
Since Kotlin
Represents a value of a functional type, such as a lambda, an anonymous function or a function reference.
Functions
Creates a Continuation instance with the given context and implementation of resumeWith method.
Since Kotlin
Creates a coroutine without a receiver and with result type T. This function creates a new, fresh instance of suspendable computation every time it is invoked.
Since Kotlin
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.
Since Kotlin
Returns the current element if it is associated with the given key in a polymorphic manner or null
otherwise. This method returns non-null value if either Element.key is equal to the given key or if the key is associated with Element.key via AbstractCoroutineContextKey. See AbstractCoroutineContextKey for the example of usage.
Since Kotlin
Returns empty coroutine context if the element is associated with the given key in a polymorphic manner or null
otherwise. This method returns empty context if either Element.key is equal to the given key or if the key is associated with Element.key via AbstractCoroutineContextKey. See AbstractCoroutineContextKey for the example of usage.
Since Kotlin
Resumes the execution of the corresponding coroutine so that the exception is re-thrown right after the last suspension point.
Since Kotlin
Starts a coroutine without a receiver and with result type T. This function creates and starts a new, fresh instance of suspendable computation every time it is invoked. The completion continuation is invoked when the coroutine completes with a result or an exception.
Since Kotlin
Starts a coroutine with receiver type R and result type T. This function creates and starts a new, fresh instance of suspendable computation every time it is invoked. The completion continuation is invoked when the coroutine completes with a result or an exception.
Since Kotlin
Obtains the current continuation instance inside suspend functions and suspends the currently running coroutine.