Skip to content

Commit 1293ccd

Browse files
committed
Coroutine guide: more on cancellation and "Composing suspending functions" section
1 parent 79a2868 commit 1293ccd

16 files changed

+451
-44
lines changed

coroutines-guide.md

Lines changed: 297 additions & 29 deletions
Large diffs are not rendered by default.

kotlinx-coroutines-core/src/test/kotlin/examples/example-01.kt renamed to kotlinx-coroutines-core/src/test/kotlin/examples/example-11.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package examples
1+
package example11
22

33
import kotlinx.coroutines.experimental.CommonPool
44
import kotlinx.coroutines.experimental.delay

kotlinx-coroutines-core/src/test/kotlin/examples/example-02.kt renamed to kotlinx-coroutines-core/src/test/kotlin/examples/example-12.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package examples
1+
package example12
22

33
import kotlinx.coroutines.experimental.CommonPool
44
import kotlinx.coroutines.experimental.delay

kotlinx-coroutines-core/src/test/kotlin/examples/example-03.kt renamed to kotlinx-coroutines-core/src/test/kotlin/examples/example-13.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package examples
1+
package example13
22

33
import kotlinx.coroutines.experimental.*
44

kotlinx-coroutines-core/src/test/kotlin/examples/example-04.kt renamed to kotlinx-coroutines-core/src/test/kotlin/examples/example-14.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package examples
1+
package example14
22

33
import kotlinx.coroutines.experimental.*
44

kotlinx-coroutines-core/src/test/kotlin/examples/example-05.kt renamed to kotlinx-coroutines-core/src/test/kotlin/examples/example-15.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package examples
1+
package example15
22

33
import kotlinx.coroutines.experimental.*
44

kotlinx-coroutines-core/src/test/kotlin/examples/example-06.kt renamed to kotlinx-coroutines-core/src/test/kotlin/examples/example-16.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package examples
1+
package example16
22

33
import kotlinx.coroutines.experimental.CommonPool
44
import kotlinx.coroutines.experimental.delay

kotlinx-coroutines-core/src/test/kotlin/examples/example-07.kt renamed to kotlinx-coroutines-core/src/test/kotlin/examples/example-21.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package examples
1+
package example21
22

33
import kotlinx.coroutines.experimental.CommonPool
44
import kotlinx.coroutines.experimental.delay
@@ -13,8 +13,8 @@ fun main(args: Array<String>) = runBlocking<Unit> {
1313
}
1414
}
1515
delay(1300L) // delay a bit
16-
println("I'm tired of waiting!")
16+
println("main: I'm tired of waiting!")
1717
job.cancel() // cancels the job
1818
delay(1300L) // delay a bit to ensure it was cancelled indeed
19-
println("Now I can quit.")
19+
println("main: Now I can quit.")
2020
}

kotlinx-coroutines-core/src/test/kotlin/examples/example-08.kt renamed to kotlinx-coroutines-core/src/test/kotlin/examples/example-22.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package examples
1+
package example22
22

33
import kotlinx.coroutines.experimental.CommonPool
44
import kotlinx.coroutines.experimental.delay
@@ -18,8 +18,8 @@ fun main(args: Array<String>) = runBlocking<Unit> {
1818
}
1919
}
2020
delay(1300L) // delay a bit
21-
println("I'm tired of waiting!")
21+
println("main: I'm tired of waiting!")
2222
job.cancel() // cancels the job
2323
delay(1300L) // delay a bit to see if it was cancelled....
24-
println("Now I can quit.")
24+
println("main: Now I can quit.")
2525
}

kotlinx-coroutines-core/src/test/kotlin/examples/example-09.kt renamed to kotlinx-coroutines-core/src/test/kotlin/examples/example-23.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package examples
1+
package example23
22

33
import kotlinx.coroutines.experimental.CommonPool
44
import kotlinx.coroutines.experimental.delay
@@ -18,8 +18,8 @@ fun main(args: Array<String>) = runBlocking<Unit> {
1818
}
1919
}
2020
delay(1300L) // delay a bit
21-
println("I'm tired of waiting!")
21+
println("main: I'm tired of waiting!")
2222
job.cancel() // cancels the job
2323
delay(1300L) // delay a bit to see if it was cancelled....
24-
println("Now I can quit.")
24+
println("main: Now I can quit.")
2525
}

0 commit comments

Comments
 (0)