Skip to content

Commit d002162

Browse files
committed
Fixed coroutines guide example-context-02 file and predictability
1 parent a1fe3da commit d002162

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

coroutines-guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ fun main(args: Array<String>) = runBlocking<Unit> {
796796
val jobs = arrayListOf<Job>()
797797
jobs += launch(Unconfined) { // not confined -- will work with main thread
798798
println(" 'Unconfined': I'm working in thread ${Thread.currentThread().name}")
799-
delay(1000)
799+
delay(500)
800800
println(" 'Unconfined': After delay in thread ${Thread.currentThread().name}")
801801
}
802802
jobs += launch(context) { // context of the parent, runBlocking coroutine
@@ -808,7 +808,7 @@ fun main(args: Array<String>) = runBlocking<Unit> {
808808
}
809809
```
810810

811-
> You can get full code [here](kotlinx-coroutines-core/src/test/kotlin/guide/example-contest-02.kt)
811+
> You can get full code [here](kotlinx-coroutines-core/src/test/kotlin/guide/example-context-02.kt)
812812
813813
Produces the output:
814814

kotlinx-coroutines-core/src/test/kotlin/guide/example-contest-02.kt renamed to kotlinx-coroutines-core/src/test/kotlin/guide/example-context-02.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
*/
1616

1717
// This file was automatically generated from coroutines-guide.md by Knit tool. Do not edit.
18-
package guide.contest.example02
18+
package guide.context.example02
1919

2020
import kotlinx.coroutines.experimental.*
2121

2222
fun main(args: Array<String>) = runBlocking<Unit> {
2323
val jobs = arrayListOf<Job>()
2424
jobs += launch(Unconfined) { // not confined -- will work with main thread
2525
println(" 'Unconfined': I'm working in thread ${Thread.currentThread().name}")
26-
delay(1000)
26+
delay(500)
2727
println(" 'Unconfined': After delay in thread ${Thread.currentThread().name}")
2828
}
2929
jobs += launch(context) { // context of the parent, runBlocking coroutine

kotlinx-coroutines-core/src/test/kotlin/guide/test/GuideTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ class GuideTest {
167167
}
168168

169169
@Test
170-
fun testGuideContestExample02() {
171-
test { guide.contest.example02.main(emptyArray()) }.verifyLinesStart(
170+
fun testGuideContextExample02() {
171+
test { guide.context.example02.main(emptyArray()) }.verifyLinesStart(
172172
" 'Unconfined': I'm working in thread main",
173173
" 'context': I'm working in thread main",
174174
" 'Unconfined': After delay in thread kotlinx.coroutines.ScheduledExecutor",

0 commit comments

Comments
 (0)