abstract fun copyForChild(): CopyableThreadContextElement<S>

Returns a CopyableThreadContextElement to replace thisCopyableThreadContextElement in the child coroutine's context that is under construction if the added context does not contain an element with the same key.

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.


Link copied to clipboard