Skip to content

Commit 9530760

Browse files
authored
Update CoroutineScope() factory documentation (#2892)
* Update CoroutineScope() factory documentation Fixes #2891
1 parent 42b3217 commit 9530760

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

kotlinx-coroutines-core/common/src/CoroutineScope.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import kotlin.coroutines.*
1212
import kotlin.coroutines.intrinsics.*
1313

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

0 commit comments

Comments
 (0)