Skip to content

Commit d3f21df

Browse files
authored
Update coroutines-and-channels.md (#3410)
A few grammar fixes
1 parent c013459 commit d3f21df

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/topics/coroutines-and-channels.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ This API is used by the `loadContributorsBlocking()` function to fetch the list
142142
* The final item on each line is the actual message: how many repositories or contributors were loaded.
143143

144144
This log output demonstrates that all the results were logged from the main thread. When you run the code with a _BLOCKING_
145-
option, the window freezes and don't react to input until the loading is finished. All the requests are executed from
146-
the same thread as the one called `loadContributorsBlocking()` from, which is the main UI thread (in Swing, it's an AWT
145+
option, the window freezes and doesn't react to input until the loading is finished. All the requests are executed from
146+
the same thread as the one that called `loadContributorsBlocking()`, which is the main UI thread (in Swing, it's an AWT
147147
event dispatching thread). This main thread gets blocked, and that's why the UI is frozen:
148148
149149
![The blocked main thread](blocking.png){width=700}
@@ -311,14 +311,14 @@ fun loadContributorsCallbacks(
311311
val allUsers = mutableListOf<User>()
312312
for (repo in repos) {
313313
service.getRepoContributorsCall(req.org, repo.name)
314-
.onResponse { responseUsers ->
314+
.onResponse { responseUsers -> // #2
315315
logUsers(repo, responseUsers)
316316
val users = responseUsers.bodyList()
317317
allUsers += users
318318
}
319319
}
320320
}
321-
// TODO: Why this code doesn't work? How to fix that?
321+
// TODO: Why doesn't this code work? How to fix that?
322322
updateResults(allUsers.aggregate())
323323
}
324324
```
@@ -441,7 +441,7 @@ interface GitHubService {
441441
```
442442
443443
* `getOrgRepos()` is defined as a `suspend` function. When you use a suspending function to perform a request, the
444-
underlying thread isn't blocked. You'll find the details on how it works exactly later.
444+
underlying thread isn't blocked. You'll find the details on how it exactly works later.
445445
* `getOrgRepos()` returns the result directly instead of returning a `Call`. If the result is unsuccessful, an
446446
exception is thrown.
447447
@@ -1546,4 +1546,4 @@ can see the difference in tests using virtual time.
15461546
## What's next
15471547

15481548
* Check out the [Asynchronous Programming with Kotlin](https://kotlinconf.com/workshops/) workshop at KotlinConf.
1549-
* Find out more about using [virtual time and experimental testing package](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-test/).
1549+
* Find out more about using [virtual time and experimental testing package](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-test/).

0 commit comments

Comments
 (0)