File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
core/kotlinx-coroutines-core/src/test/kotlin/guide Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change 17
17
// This file was automatically generated from coroutines-guide.md by Knit tool. Do not edit.
18
18
package guide.context.example06
19
19
20
- import kotlinx.coroutines.experimental.*
20
+ import kotlinx.coroutines.experimental.delay
21
+ import kotlinx.coroutines.experimental.launch
22
+ import kotlinx.coroutines.experimental.runBlocking
21
23
22
24
fun main (args : Array <String >) = runBlocking<Unit > {
23
25
// launch a coroutine to process some kind of incoming request
@@ -30,6 +32,7 @@ fun main(args: Array<String>) = runBlocking<Unit> {
30
32
}
31
33
// and the other inherits the parent context
32
34
val job2 = launch(coroutineContext) {
35
+ delay(100 )
33
36
println (" job2: I am a child of the request coroutine" )
34
37
delay(1000 )
35
38
println (" job2: I will not execute this line if my parent request is cancelled" )
Original file line number Diff line number Diff line change @@ -1004,6 +1004,7 @@ fun main(args: Array<String>) = runBlocking<Unit> {
1004
1004
}
1005
1005
// and the other inherits the parent context
1006
1006
val job2 = launch(coroutineContext) {
1007
+ delay(100 )
1007
1008
println (" job2: I am a child of the request coroutine" )
1008
1009
delay(1000 )
1009
1010
println (" job2: I will not execute this line if my parent request is cancelled" )
You can’t perform that action at this time.
0 commit comments