@@ -321,8 +321,8 @@ This section covers coroutine cancellation and timeouts.
321
321
322
322
### Cancelling coroutine execution
323
323
324
- In small application the return from "main" method might sound like a good idea to get all coroutines
325
- implicitly terminated. In a larger, long-running application, you need finer-grained control.
324
+ In a small application the return from "main" method might sound like a good idea to get all coroutines
325
+ implicitly terminated but in a larger, long-running application, you need finer-grained control.
326
326
The [ launch] function returns a [ Job] that can be used to cancel running coroutine:
327
327
328
328
``` kotlin
@@ -448,7 +448,7 @@ main: Now I can quit.
448
448
### Closing resources with finally
449
449
450
450
Cancellable suspending functions throw [ CancellationException] on cancellation which can be handled in
451
- all the usual way. For example, ` try {...} finally {...} ` expression and Kotlin ` use ` function execute their
451
+ the usual way. For example, ` try {...} finally {...} ` expression and Kotlin ` use ` function execute their
452
452
finalization actions normally when coroutine is cancelled:
453
453
454
454
``` kotlin
@@ -532,7 +532,7 @@ main: Now I can quit.
532
532
533
533
### Timeout
534
534
535
- The most obvious reason to cancel coroutine execution in practice,
535
+ The most obvious reason to cancel coroutine execution in practice
536
536
is because its execution time has exceeded some timeout.
537
537
While you can manually track the reference to the corresponding [ Job] and launch a separate coroutine to cancel
538
538
the tracked one after delay, there is a ready to use [ withTimeout] function that does it.
0 commit comments