File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
kotlinx-coroutines-core/src/test/kotlin/guide Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -533,7 +533,7 @@ Exception in thread "main" java.util.concurrent.CancellationException: Timed out
533533<!-- - TEST STARTS_WITH -->
534534
535535We have not seen the [ CancellationException] stack trace printed on the console before. That is because
536- inside a cancelled coroutine ` CancellationException ` is a considered a normal reason for coroutine completion.
536+ inside a cancelled coroutine ` CancellationException ` is considered to be a normal reason for coroutine completion.
537537However, in this example we have used ` withTimeout ` right inside the ` main ` function.
538538
539539Because cancellation is just an exception, all the resources will be closed in a usual way.
@@ -806,7 +806,7 @@ Produces the output:
806806
807807<!-- - TEST LINES_START -->
808808
809- So, the coroutine the had inherited ` context ` of ` runBlocking {...} ` continues to execute in the ` main ` thread,
809+ So, the coroutine that had inherited ` context ` of ` runBlocking {...} ` continues to execute in the ` main ` thread,
810810while the unconfined one had resumed in the scheduler thread that [ delay] function is using.
811811
812812### Debugging coroutines and threads
@@ -1905,7 +1905,7 @@ fun main(args: Array<String>) = runBlocking<Unit> {
19051905 }
19061906 }
19071907 println (result)
1908- val countActive = list.sumBy { deferred -> if (deferred .isActive) 1 else 0 }
1908+ val countActive = list.count { it .isActive }
19091909 println (" $countActive coroutines are still active" )
19101910}
19111911```
Original file line number Diff line number Diff line change @@ -42,6 +42,6 @@ fun main(args: Array<String>) = runBlocking<Unit> {
4242 }
4343 }
4444 println (result)
45- val countActive = list.sumBy { deferred -> if (deferred .isActive) 1 else 0 }
45+ val countActive = list.count { it .isActive }
4646 println (" $countActive coroutines are still active" )
4747}
You can’t perform that action at this time.
0 commit comments