newCoroutineContext

fun <ERROR CLASS>.newCoroutineContext(
    context: CoroutineContext
): CoroutineContext
(source)

Creates context for the new coroutine. It installs Dispatchers.Default when no other dispatcher nor ContinuationInterceptor is specified, and adds optional support for debugging facilities (when turned on).

Debugging facilities: In debug mode every coroutine is assigned a unique consecutive identifier. Every thread that executes a coroutine has its name modified to include the name and identifier of the currently running coroutine. When one coroutine is suspended and resumes another coroutine that is dispatched in the same thread, then the thread name displays the whole stack of coroutine descriptions that are being executed on this thread.

Enable debugging facilities with “kotlinx.coroutines.debug” (DEBUG_PROPERTY_NAME) system property , use the following values:

Coroutine name can be explicitly assigned using CoroutineName context element. The string “coroutine” is used as a default name.

Note: This is an experimental api. Behavior of this function may change in the future with respect to its support for debugging facilities.

expect fun CoroutineScope.newCoroutineContext(
    context: CoroutineContext
): CoroutineContext
(source)