File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -1571,6 +1571,11 @@ Processor #3 received 10
1571
1571
Note, that cancelling a producer coroutine closes its channel, thus eventually terminating iteration
1572
1572
over the channel that processor coroutines are doing.
1573
1573
1574
+ Also, pay attention to how we explicitly iterate over channel with ` for ` loop to perform fan-out in ` launchProcessor ` code.
1575
+ Unlike ` consumeEach ` , this ` for ` loop pattern is perfectly safe to use from multiple coroutines. If one of the processor
1576
+ coroutines fails, then others would still be processing the channel, while a processor that is written via ` consumeEach `
1577
+ always consumes (cancels) the underlying channel on its normal or abnormal termination.
1578
+
1574
1579
### Fan-in
1575
1580
1576
1581
Multiple coroutines may send to the same channel.
You can’t perform that action at this time.
0 commit comments