Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update withContext KDoc #3309

Merged
merged 5 commits into from Jun 7, 2022
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions kotlinx-coroutines-core/common/src/Builders.common.kt
Expand Up @@ -126,12 +126,13 @@ private class LazyDeferredCoroutine<T>(
* This suspending function is cancellable. It immediately checks for cancellation of
* the resulting context and throws [CancellationException] if it is not [active][CoroutineContext.isActive].
*
* This function uses dispatcher from the new context, shifting execution of the [block] into the
* different thread if a new dispatcher is specified, and back to the original dispatcher
* when it completes. Note that the result of `withContext` invocation is
* dispatched into the original context in a cancellable way with a **prompt cancellation guarantee**,
* which means that if the original [coroutineContext], in which `withContext` was invoked,
* is cancelled by the time its dispatcher starts to execute the code,
* This function redispatches the given [block] if and only if a different [CoroutineDispatcher]
* was explicitly supplied with the `coroutineContext` argument, shifting the execution
* back to the original dispatcher when the [block] completes.
qwwdfsad marked this conversation as resolved.
Show resolved Hide resolved
*
* Note that the result of `withContext` invocation is dispatched into the original context in a cancellable way
* with a **prompt cancellation guarantee**, which means that if the original [coroutineContext]
* in which `withContext` was invoked is cancelled by the time its dispatcher starts to execute the code,
* it discards the result of `withContext` and throws [CancellationException].
*
* The cancellation behaviour described above is enabled if and only if the dispatcher is being changed.
Expand Down