Skip to content

Commit 58ca5a3

Browse files
rilligpablobaxter
authored andcommitted
Fix typos in Cancellation and Timeouts docs (Kotlin#3317)
1 parent 5605675 commit 58ca5a3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/topics/cancellation-and-timeouts.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ fun main() = runBlocking {
137137

138138
While catching `Exception` is an anti-pattern, this issue may surface in more subtle ways, like when using the
139139
[`runCatching`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/run-catching.html) function,
140-
which does not know rethrow [CancellationException].
140+
which does not rethrow [CancellationException].
141141

142142
## Making computation code cancellable
143143

@@ -190,8 +190,8 @@ main: Now I can quit.
190190

191191
## Closing resources with `finally`
192192

193-
Cancellable suspending functions throw [CancellationException] on cancellation which can be handled in
194-
the usual way. For example, `try {...} finally {...}` expression and Kotlin `use` function execute their
193+
Cancellable suspending functions throw [CancellationException] on cancellation, which can be handled in
194+
the usual way. For example, the `try {...} finally {...}` expression and Kotlin's `use` function execute their
195195
finalization actions normally when a coroutine is cancelled:
196196

197197
```kotlin
@@ -423,13 +423,13 @@ fun main() {
423423
If you run the above code you'll see that it does not always print zero, though it may depend on the timings
424424
of your machine you may need to tweak timeouts in this example to actually see non-zero values.
425425

426-
> Note, that incrementing and decrementing `acquired` counter here from 100K coroutines is completely safe,
426+
> Note that incrementing and decrementing `acquired` counter here from 100K coroutines is completely safe,
427427
> since it always happens from the same main thread. More on that will be explained in the chapter
428428
> on coroutine context.
429429
>
430430
{type="note"}
431431

432-
To workaround this problem you can store a reference to the resource in the variable as opposed to returning it
432+
To work around this problem you can store a reference to the resource in the variable as opposed to returning it
433433
from the `withTimeout` block.
434434

435435
```kotlin

0 commit comments

Comments
 (0)