On Mon, Nov 17, 2014 at 10:04 PM, Philip Thomas wrote:

Can you examine the size of the buffer in the channel, e.g. to see if it
is empty or full, without modifying the channel?

Don't do this by asking for the length of the channel. Just try to read a
value out of the channel without blocking and handle the events from there.
It is pretty important to make sure your channel operations are safe from
data races. Otherwise you introduce small bugs in the code base which are
hard to find later on. It tend to be better to drive it by events on the
channels rather than looking at "side information".


You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 9 | next ›
Discussion Overview
groupgolang-nuts @
postedNov 17, '14 at 9:04p
activeNov 18, '14 at 11:04p



site design / logo © 2021 Grokbase