File tree 1 file changed +6
-6
lines changed
kotlinx-coroutines-core/common/src
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -42,14 +42,14 @@ import kotlin.coroutines.intrinsics.*
42
42
* ### Custom usage
43
43
*
44
44
* `CoroutineScope` should be declared as a property on entities with a well-defined lifecycle that are
45
- * responsible for launching children coroutines. The corresponding instance of `CoroutineScope` shall be created
46
- * with either `CoroutineScope()` or `MainScope()` functions. The difference between them is only in the
47
- * [CoroutineDispatcher]:
45
+ * responsible for launching child coroutines. The corresponding instance of `CoroutineScope` shall be created
46
+ * with either `CoroutineScope()` or `MainScope()`:
48
47
*
49
- * * `CoroutineScope()` uses [Dispatchers.Default] for its coroutines.
50
- * * `MainScope()` uses [Dispatchers.Main] for its coroutines.
48
+ * * `CoroutineScope()` uses the [context][CoroutineContext] provided to it as a parameter for its coroutines
49
+ * and adds a [Job] if one is not provided as part of the context.
50
+ * * `MainScope()` uses [Dispatchers.Main] for its coroutines and has a [SupervisorJob].
51
51
*
52
- * **The key part of custom usage of `CustomScope ` is cancelling it at the end of the lifecycle.**
52
+ * **The key part of custom usage of `CoroutineScope ` is cancelling it at the end of the lifecycle.**
53
53
* The [CoroutineScope.cancel] extension function shall be used when the entity that was launching coroutines
54
54
* is no longer needed. It cancels all the coroutines that might still be running on behalf of it.
55
55
*
You can’t perform that action at this time.
0 commit comments