@@ -333,8 +333,8 @@ This section covers coroutine cancellation and timeouts.
333
333
334
334
### Cancelling coroutine execution
335
335
336
- In small application the return from "main" method might sound like a good idea to get all coroutines
337
- implicitly terminated. In a larger, long-running application, you need finer-grained control.
336
+ In a small application the return from "main" method might sound like a good idea to get all coroutines
337
+ implicitly terminated but in a larger, long-running application, you need finer-grained control.
338
338
The [ launch] function returns a [ Job] that can be used to cancel running coroutine:
339
339
340
340
``` kotlin
@@ -460,7 +460,7 @@ main: Now I can quit.
460
460
### Closing resources with finally
461
461
462
462
Cancellable suspending functions throw [ CancellationException] on cancellation which can be handled in
463
- all the usual way. For example, ` try {...} finally {...} ` expression and Kotlin ` use ` function execute their
463
+ the usual way. For example, ` try {...} finally {...} ` expression and Kotlin ` use ` function execute their
464
464
finalization actions normally when coroutine is cancelled:
465
465
466
466
``` kotlin
@@ -544,7 +544,7 @@ main: Now I can quit.
544
544
545
545
### Timeout
546
546
547
- The most obvious reason to cancel coroutine execution in practice,
547
+ The most obvious reason to cancel coroutine execution in practice
548
548
is because its execution time has exceeded some timeout.
549
549
While you can manually track the reference to the corresponding [ Job] and launch a separate coroutine to cancel
550
550
the tracked one after delay, there is a ready to use [ withTimeout] function that does it.
0 commit comments