3 ms·
Channels are inherently FIFO queues. So why not just use the usual `select`/`case` method and cast the `struct` you need into a chan with `make(chan, struct)`?
by kixpanganiban 10y ago
Channels are inherently FIFO queues. So why not just use the usual `select`/`case` method and cast the `struct` you need into a chan with `make(chan, struct)`?
See: https://gobyexample.com/non-blocking-channel-operations https://gobyexample.com/non-blocking-channel-operations
- Xeoncross 10y agoAre you talking about doing this instead of buffering the channel? The reason I buffer it is because I don't want whatever is providing the worker with a message to block while waiting to send to the workers.