From 8c65b5bf72eff92c83f53770c4a801e47589f32a Mon Sep 17 00:00:00 2001 From: Nicklas Ansman Date: Mon, 30 Jan 2023 11:24:31 -0500 Subject: [PATCH] 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 #3605 and [KT-47032](https://youtrack.jetbrains.com/issue/KT-47032/Incorrect-code-example-for-Dispatchers.Unconfined-in-kotlinx.coroutines-docs) --- kotlinx-coroutines-core/common/src/Dispatchers.common.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kotlinx-coroutines-core/common/src/Dispatchers.common.kt b/kotlinx-coroutines-core/common/src/Dispatchers.common.kt index 28e67a423d..7ed4e126f0 100644 --- a/kotlinx-coroutines-core/common/src/Dispatchers.common.kt +++ b/kotlinx-coroutines-core/common/src/Dispatchers.common.kt @@ -56,7 +56,7 @@ public expect object Dispatchers { * ``` * withContext(Dispatchers.Unconfined) { * println(1) - * withContext(Dispatchers.Unconfined) { // Nested unconfined + * launch(Dispatchers.Unconfined) { // Nested unconfined * println(2) * } * println(3)