How to know a buffered channel is full? I don\'t know to be blocked when the buffered channel is full, instead I choose to drop the item sent to the buffered channel.
Another useful example I stumbled upon was this nifty implementation of Ring Buffer.
The quote from the source:
The idea is simple: Connect two buffered channels through one Goroutine that forwards messages from the incoming channel to the outgoing channel. Whenever a new message can not be placed on on the outgoing channel, take one message out of the outgoing channel (that is the oldest message in the buffer), drop it, and place the new message in the newly freed up outgoing channel.
Check out this C version as well...