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
15711571Note, that cancelling a producer coroutine closes its channel, thus eventually terminating iteration
15721572over the channel that processor coroutines are doing.
15731573
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+
15741579### Fan-in
15751580
15761581Multiple coroutines may send to the same channel.
You can’t perform that action at this time.
0 commit comments