Skip to content

Commit d106ac7

Browse files
Docs: avoid scrolling sample code; fix test description; add () to functions calls (#4080)
1 parent f9a4545 commit d106ac7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

docs/topics/coroutines-and-channels.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ This API is used by the `loadContributorsBlocking()` function to fetch the list
9191
1. Open `src/tasks/Request1Blocking.kt` to see its implementation:
9292

9393
```kotlin
94-
fun loadContributorsBlocking(service: GitHubService, req: RequestData): List<User> {
94+
fun loadContributorsBlocking(
95+
service: GitHubService,
96+
req: RequestData
97+
): List<User> {
9598
val repos = service
9699
.getOrgReposCall(req.org) // #1
97100
.execute() // #2
@@ -328,7 +331,8 @@ fun loadContributorsCallbacks(
328331
* The logic for handling the responses is extracted into callbacks: the corresponding lambdas start at lines `#1` and `#2`.
329332

330333
However, the provided solution doesn't work. If you run the program and load contributors by choosing the _CALLBACKS_
331-
option, you'll see that nothing is shown. However, the tests that immediately return the result pass.
334+
option, you'll see that nothing is shown. However, the test from `Request3CallbacksKtTest` immediately returns the result
335+
that it successfully passed.
332336

333337
Think about why the given code doesn't work as expected and try to fix it, or see the solutions below.
334338
@@ -1206,8 +1210,8 @@ When the channel is full, the next `send` call on it is suspended until more fre
12061210
<def title="Rendezvous channel">
12071211
<p>The "Rendezvous" channel is a channel without a buffer, the same as a buffered channel with zero size.
12081212
One of the functions (<code>send()</code> or <code>receive()</code>) is always suspended until the other is called. </p>
1209-
<p>If the <code>send()</code> function is called and there's no suspended <code>receive</code> call ready to process the element, then <code>send()</code>
1210-
is suspended. Similarly, if the <code>receive</code> function is called and the channel is empty or, in other words, there's no
1213+
<p>If the <code>send()</code> function is called and there's no suspended <code>receive()</code> call ready to process the element, then <code>send()</code>
1214+
is suspended. Similarly, if the <code>receive()</code> function is called and the channel is empty or, in other words, there's no
12111215
suspended <code>send()</code> call ready to send the element, the <code>receive()</code> call is suspended. </p>
12121216
<p>The "rendezvous" name ("a meeting at an agreed time and place") refers to the fact that <code>send()</code> and <code>receive()</code>
12131217
should "meet on time".</p>

0 commit comments

Comments
 (0)