4 ms·
I believe the idiomatic way to solve multiple writers would be to give each writer it's own channel, and multiplex the output of those to a single channel. The
by jusssi 11y ago
I believe the idiomatic way to solve multiple writers would be to give each writer it's own channel, and multiplex the output of those to a single channel. The problem is, without generics you need to create a new multiplexer for every type of channel payload.
Also, if semantics make life complicated, they should be changed. Since there's already an 'ok' return flag for channel receive, I have hard time understanding why there can't be one for channel send.
- tshannon 11y agoYeah, I've found the simplest way to have multiple writers / readers is a mutex. I was suprised to read that they actually consider removing the sync/atomic packages. It's crucial in my opinion, and would complicate a lot of code if had to be written with channels.