Skip to content

Update select-guide timings to be precise #3387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/topics/select-expression.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ import kotlinx.coroutines.selects.*

fun CoroutineScope.fizz() = produce<String> {
while (true) { // sends "Fizz" every 300 ms
delay(300)
delay(500)
send("Fizz")
}
}

fun CoroutineScope.buzz() = produce<String> {
while (true) { // sends "Buzz!" every 500 ms
delay(500)
delay(1000)
send("Buzz!")
}
}
Expand Down Expand Up @@ -112,7 +112,7 @@ fizz -> 'Fizz'
fizz -> 'Fizz'
buzz -> 'Buzz!'
fizz -> 'Fizz'
buzz -> 'Buzz!'
fizz -> 'Fizz'
```

<!--- TEST -->
Expand Down
4 changes: 2 additions & 2 deletions kotlinx-coroutines-core/jvm/test/guide/example-select-01.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import kotlinx.coroutines.selects.*

fun CoroutineScope.fizz() = produce<String> {
while (true) { // sends "Fizz" every 300 ms
delay(300)
delay(500)
send("Fizz")
}
}

fun CoroutineScope.buzz() = produce<String> {
while (true) { // sends "Buzz!" every 500 ms
delay(500)
delay(1000)
send("Buzz!")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class SelectGuideTest {
"fizz -> 'Fizz'",
"buzz -> 'Buzz!'",
"fizz -> 'Fizz'",
"buzz -> 'Buzz!'"
"fizz -> 'Fizz'"
)
}

Expand Down