Skip to content

Commit 8c65b5b

Browse files
authored
Update the code example for Dispatchers.Unconfined
The previous example used `withContext` which is guaranteed to complete before the code after it runs. The updated example uses `launch` which I think was originally intended. This fixes Kotlin#3605 and [KT-47032](https://youtrack.jetbrains.com/issue/KT-47032/Incorrect-code-example-for-Dispatchers.Unconfined-in-kotlinx.coroutines-docs)
1 parent e7ddb2d commit 8c65b5b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public expect object Dispatchers {
5656
* ```
5757
* withContext(Dispatchers.Unconfined) {
5858
* println(1)
59-
* withContext(Dispatchers.Unconfined) { // Nested unconfined
59+
* launch(Dispatchers.Unconfined) { // Nested unconfined
6060
* println(2)
6161
* }
6262
* println(3)

0 commit comments

Comments
 (0)