File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -332,7 +332,7 @@ scope and that is what [coroutineScope] function provides:
332
332
suspend fun concurrentSum (): Int = coroutineScope {
333
333
val one = async { doSomethingUsefulOne() }
334
334
val two = async { doSomethingUsefulTwo() }
335
- one.await() + two.await()
335
+ one.await() + two.await()
336
336
}
337
337
```
338
338
@@ -350,18 +350,18 @@ import kotlinx.coroutines.*
350
350
import kotlin.system.*
351
351
352
352
fun main () = runBlocking<Unit > {
353
- // sampleStart
353
+ // sampleStart
354
354
val time = measureTimeMillis {
355
355
println (" The answer is ${concurrentSum()} " )
356
356
}
357
357
println (" Completed in $time ms" )
358
- // sampleEnd
358
+ // sampleEnd
359
359
}
360
360
361
361
suspend fun concurrentSum (): Int = coroutineScope {
362
362
val one = async { doSomethingUsefulOne() }
363
363
val two = async { doSomethingUsefulTwo() }
364
- one.await() + two.await()
364
+ one.await() + two.await()
365
365
}
366
366
367
367
suspend fun doSomethingUsefulOne (): Int {
@@ -418,7 +418,7 @@ suspend fun failedConcurrentSum(): Int = coroutineScope {
418
418
println (" Second child throws an exception" )
419
419
throw ArithmeticException ()
420
420
}
421
- one.await() + two.await()
421
+ one.await() + two.await()
422
422
}
423
423
```
424
424
You can’t perform that action at this time.
0 commit comments