copyForChildCoroutine

abstract fun copyForChildCoroutine(): CopyableThreadContextElement<S>

Returns a CopyableThreadContextElement to replace thisCopyableThreadContextElement in the child coroutine's context that is under construction.

This function is called on the element each time a new coroutine inherits a context containing it, and the returned value is folded into the context given to the child.

Since this method is called whenever a new coroutine is launched in a context containing this CopyableThreadContextElement, implementations are performance-sensitive.

Sources

jvm source
Link copied to clipboard