Skip to content

Commit 5705372

Browse files
authored
Increase timeout in the example to make sure it fails with threads (#2141)
Fixes #2135
1 parent b7d6518 commit 5705372

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docs/basics.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ import kotlinx.coroutines.*
338338
fun main() = runBlocking {
339339
repeat(100_000) { // launch a lot of coroutines
340340
launch {
341-
delay(1000L)
341+
delay(5000L)
342342
print(".")
343343
}
344344
}
@@ -351,7 +351,7 @@ fun main() = runBlocking {
351351
352352
<!--- TEST lines.size == 1 && lines[0] == ".".repeat(100_000) -->
353353

354-
It launches 100K coroutines and, after a second, each coroutine prints a dot.
354+
It launches 100K coroutines and, after 5 seconds, each coroutine prints a dot.
355355

356356
Now, try that with threads. What would happen? (Most likely your code will produce some sort of out-of-memory error)
357357

kotlinx-coroutines-core/jvm/test/guide/example-basic-08.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import kotlinx.coroutines.*
1010
fun main() = runBlocking {
1111
repeat(100_000) { // launch a lot of coroutines
1212
launch {
13-
delay(1000L)
13+
delay(5000L)
1414
print(".")
1515
}
1616
}

0 commit comments

Comments
 (0)