kotlin coroutine context code example

Example: kotlin coroutine context

It is an indexed set of Element instances where every
element in this set has a unique Key.
EmptyCoroutineContext - Does not change
coroutine behavior at all. Like an empty map.
CoroutineName - Sets a name of a coroutine for
debugging purposes.
Job - Lifecycle of a coroutine. Can be used to cancel
coroutine. A coroutine is responsible for all children with
the same Job. It waits for them and cancels all of them
if any had an error (To make children independent use
SupervisorJob).
CoroutineExceptionHandler - Used to set
exception handling for uncaught exceptions.
ContinuationInterceptor - Intercepts continuation.
Mainly used by dispatchers.

Tags:

Misc Example