Skip to content

Commit

Permalink
Update CoroutineScope() factory documentation (#2892)
Browse files Browse the repository at this point in the history
* Update CoroutineScope() factory documentation

Fixes #2891
  • Loading branch information
qwwdfsad committed Sep 2, 2021
1 parent 42b3217 commit 9530760
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions kotlinx-coroutines-core/common/src/CoroutineScope.kt
Expand Up @@ -12,7 +12,7 @@ import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*

/**
* Defines a scope for new coroutines. Every **coroutine builder** (like [launch], [async], etc)
* Defines a scope for new coroutines. Every **coroutine builder** (like [launch], [async], etc.)
* is an extension on [CoroutineScope] and inherits its [coroutineContext][CoroutineScope.coroutineContext]
* to automatically propagate all its elements and cancellation.
*
Expand All @@ -28,8 +28,8 @@ import kotlin.coroutines.intrinsics.*
* By convention, the [context of a scope][CoroutineScope.coroutineContext] should contain an instance of a
* [job][Job] to enforce the discipline of **structured concurrency** with propagation of cancellation.
*
* Every coroutine builder (like [launch], [async], etc)
* and every scoping function (like [coroutineScope], [withContext], etc) provides _its own_ scope
* Every coroutine builder (like [launch], [async], and others)
* and every scoping function (like [coroutineScope] and [withContext]) provides _its own_ scope
* with its own [Job] instance into the inner block of code it runs.
* By convention, they all wait for all the coroutines inside their block to complete before completing themselves,
* thus enforcing the structured concurrency. See [Job] documentation for more details.
Expand Down Expand Up @@ -269,8 +269,8 @@ public suspend fun <R> coroutineScope(block: suspend CoroutineScope.() -> R): R
* Creates a [CoroutineScope] that wraps the given coroutine [context].
*
* If the given [context] does not contain a [Job] element, then a default `Job()` is created.
* This way, cancellation or failure of any child coroutine in this scope cancels all the other children,
* just like inside [coroutineScope] block.
* This way, failure of any child coroutine in this scope or [cancellation][CoroutineScope.cancel] of the scope itself
* cancels all the scope's children, just like inside [coroutineScope] block.
*/
@Suppress("FunctionName")
public fun CoroutineScope(context: CoroutineContext): CoroutineScope =
Expand Down

0 comments on commit 9530760

Please sign in to comment.