Skip to content

Commit 74619c1

Browse files
committed
Fixed sporadic failure of example-context-06
Fixes Kotlin#160
1 parent d166eb6 commit 74619c1

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
// This file was automatically generated from coroutines-guide.md by Knit tool. Do not edit.
1818
package guide.context.example06
1919

20-
import kotlinx.coroutines.experimental.*
20+
import kotlinx.coroutines.experimental.delay
21+
import kotlinx.coroutines.experimental.launch
22+
import kotlinx.coroutines.experimental.runBlocking
2123

2224
fun main(args: Array<String>) = runBlocking<Unit> {
2325
// launch a coroutine to process some kind of incoming request
@@ -30,6 +32,7 @@ fun main(args: Array<String>) = runBlocking<Unit> {
3032
}
3133
// and the other inherits the parent context
3234
val job2 = launch(coroutineContext) {
35+
delay(100)
3336
println("job2: I am a child of the request coroutine")
3437
delay(1000)
3538
println("job2: I will not execute this line if my parent request is cancelled")

coroutines-guide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,7 @@ fun main(args: Array<String>) = runBlocking<Unit> {
10041004
}
10051005
// and the other inherits the parent context
10061006
val job2 = launch(coroutineContext) {
1007+
delay(100)
10071008
println("job2: I am a child of the request coroutine")
10081009
delay(1000)
10091010
println("job2: I will not execute this line if my parent request is cancelled")

0 commit comments

Comments
 (0)