File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
kotlinx-coroutines-core/src/test/kotlin/guide Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -796,7 +796,7 @@ fun main(args: Array<String>) = runBlocking<Unit> {
796
796
val jobs = arrayListOf<Job >()
797
797
jobs + = launch(Unconfined ) { // not confined -- will work with main thread
798
798
println (" 'Unconfined': I'm working in thread ${Thread .currentThread().name} " )
799
- delay(1000 )
799
+ delay(500 )
800
800
println (" 'Unconfined': After delay in thread ${Thread .currentThread().name} " )
801
801
}
802
802
jobs + = launch(context) { // context of the parent, runBlocking coroutine
@@ -808,7 +808,7 @@ fun main(args: Array<String>) = runBlocking<Unit> {
808
808
}
809
809
```
810
810
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 )
812
812
813
813
Produces the output:
814
814
Original file line number Diff line number Diff line change 15
15
*/
16
16
17
17
// 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
19
19
20
20
import kotlinx.coroutines.experimental.*
21
21
22
22
fun main (args : Array <String >) = runBlocking<Unit > {
23
23
val jobs = arrayListOf<Job >()
24
24
jobs + = launch(Unconfined ) { // not confined -- will work with main thread
25
25
println (" 'Unconfined': I'm working in thread ${Thread .currentThread().name} " )
26
- delay(1000 )
26
+ delay(500 )
27
27
println (" 'Unconfined': After delay in thread ${Thread .currentThread().name} " )
28
28
}
29
29
jobs + = launch(context) { // context of the parent, runBlocking coroutine
Original file line number Diff line number Diff line change @@ -167,8 +167,8 @@ class GuideTest {
167
167
}
168
168
169
169
@Test
170
- fun testGuideContestExample02 () {
171
- test { guide.contest .example02.main(emptyArray()) }.verifyLinesStart(
170
+ fun testGuideContextExample02 () {
171
+ test { guide.context .example02.main(emptyArray()) }.verifyLinesStart(
172
172
" 'Unconfined': I'm working in thread main" ,
173
173
" 'context': I'm working in thread main" ,
174
174
" 'Unconfined': After delay in thread kotlinx.coroutines.ScheduledExecutor" ,
You can’t perform that action at this time.
0 commit comments