Skip to content

Commit

Permalink
Update guide example to better reflect the intent (Kotlin#3292)
Browse files Browse the repository at this point in the history
* Update guide example to better reflect the intent

Based on Kotlin#3202
  • Loading branch information
qwwdfsad authored and pablobaxter committed Sep 14, 2022
1 parent 69dde8d commit 14d0207
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/topics/coroutine-context-and-dispatchers.md
Expand Up @@ -334,8 +334,8 @@ fun main() = runBlocking<Unit> {
}
delay(500)
request.cancel() // cancel processing of the request
delay(1000) // delay a second to see what happens
println("main: Who has survived request cancellation?")
delay(1000) // delay the main thread for a second to see what happens
//sampleEnd
}
```
Expand All @@ -350,8 +350,8 @@ The output of this code is:
```text
job1: I run in my own Job and execute independently!
job2: I am a child of the request coroutine
job1: I am not affected by cancellation of the request
main: Who has survived request cancellation?
job1: I am not affected by cancellation of the request
```

<!--- TEST -->
Expand Down
Expand Up @@ -26,6 +26,6 @@ fun main() = runBlocking<Unit> {
}
delay(500)
request.cancel() // cancel processing of the request
delay(1000) // delay a second to see what happens
println("main: Who has survived request cancellation?")
delay(1000) // delay the main thread for a second to see what happens
}
Expand Up @@ -59,8 +59,8 @@ class DispatcherGuideTest {
test("ExampleContext06") { kotlinx.coroutines.guide.exampleContext06.main() }.verifyLines(
"job1: I run in my own Job and execute independently!",
"job2: I am a child of the request coroutine",
"job1: I am not affected by cancellation of the request",
"main: Who has survived request cancellation?"
"main: Who has survived request cancellation?",
"job1: I am not affected by cancellation of the request"
)
}

Expand Down
Empty file.

0 comments on commit 14d0207

Please sign in to comment.