Skip to content

Commit 14d0207

Browse files
qwwdfsadpablobaxter
authored andcommitted
Update guide example to better reflect the intent (Kotlin#3292)
* Update guide example to better reflect the intent Based on Kotlin#3202
1 parent 69dde8d commit 14d0207

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

docs/topics/coroutine-context-and-dispatchers.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ fun main() = runBlocking<Unit> {
334334
}
335335
delay(500)
336336
request.cancel() // cancel processing of the request
337-
delay(1000) // delay a second to see what happens
338337
println("main: Who has survived request cancellation?")
338+
delay(1000) // delay the main thread for a second to see what happens
339339
//sampleEnd
340340
}
341341
```
@@ -350,8 +350,8 @@ The output of this code is:
350350
```text
351351
job1: I run in my own Job and execute independently!
352352
job2: I am a child of the request coroutine
353-
job1: I am not affected by cancellation of the request
354353
main: Who has survived request cancellation?
354+
job1: I am not affected by cancellation of the request
355355
```
356356

357357
<!--- TEST -->

kotlinx-coroutines-core/jvm/test/guide/example-context-06.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ fun main() = runBlocking<Unit> {
2626
}
2727
delay(500)
2828
request.cancel() // cancel processing of the request
29-
delay(1000) // delay a second to see what happens
3029
println("main: Who has survived request cancellation?")
30+
delay(1000) // delay the main thread for a second to see what happens
3131
}

kotlinx-coroutines-core/jvm/test/guide/test/DispatcherGuideTest.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ class DispatcherGuideTest {
5959
test("ExampleContext06") { kotlinx.coroutines.guide.exampleContext06.main() }.verifyLines(
6060
"job1: I run in my own Job and execute independently!",
6161
"job2: I am a child of the request coroutine",
62-
"job1: I am not affected by cancellation of the request",
63-
"main: Who has survived request cancellation?"
62+
"main: Who has survived request cancellation?",
63+
"job1: I am not affected by cancellation of the request"
6464
)
6565
}
6666

kotlinx-coroutines-core/jvm/test/guide/test/GuideTest.kt

Whitespace-only changes.

0 commit comments

Comments
 (0)