FAQ
I have a situation where I think a channel buffer is being over run, but
I'm not sure how to verify that is indeed the case.

Any ideas?

--
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

  • Matt Joiner at Mar 27, 2015 at 4:28 am
    I've had this a few times, particularly in situations where it'd be an
    error to block pushing to a channel. Try something like this

    select {
    case ch<-item:
    default:
         log.Print("channel overrun")
         ch<-item
    }
    On Friday, 27 March 2015 14:58:19 UTC+11, Curtis Paul wrote:

    I have a situation where I think a channel buffer is being over run, but
    I'm not sure how to verify that is indeed the case.

    Any ideas?
    --
    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.
  • Curtis Paul at Mar 27, 2015 at 5:10 am
    Why would the default: indicate a channel overrun?
    On Thursday, March 26, 2015 at 10:28:25 PM UTC-6, Matt Joiner wrote:

    I've had this a few times, particularly in situations where it'd be an
    error to block pushing to a channel. Try something like this

    select {
    case ch<-item:
    default:
    log.Print("channel overrun")
    ch<-item
    }
    On Friday, 27 March 2015 14:58:19 UTC+11, Curtis Paul wrote:

    I have a situation where I think a channel buffer is being over run, but
    I'm not sure how to verify that is indeed the case.

    Any ideas?
    --
    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.
  • Matt Joiner at Mar 27, 2015 at 5:17 am
    It means the send is blocked, and therefore the channel buffer is full.
    On 27 March 2015 at 16:10, Curtis Paul wrote:

    Why would the default: indicate a channel overrun?

    On Thursday, March 26, 2015 at 10:28:25 PM UTC-6, Matt Joiner wrote:

    I've had this a few times, particularly in situations where it'd be an
    error to block pushing to a channel. Try something like this

    select {
    case ch<-item:
    default:
    log.Print("channel overrun")
    ch<-item
    }
    On Friday, 27 March 2015 14:58:19 UTC+11, Curtis Paul wrote:

    I have a situation where I think a channel buffer is being over run, but
    I'm not sure how to verify that is indeed the case.

    Any ideas?
    --
    You received this message because you are subscribed to a topic in the
    Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/wIXin-KIL50/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    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.
  • Andrey mirtchovski at Mar 27, 2015 at 5:22 am
    you could, if you're on the receiving end of a channel, just query its
    length. that will give the number of elements queued on it:

    http://play.golang.org/p/TZ_PphtE8J

    if reasonably close to capacity, as a consumer you can assume that
    it's being overrun.

    the main observation here is that channels tend to be in one of two
    states: empty or full. it is rare that a channel is consistently
    half-full for example. such is the bursty nature of today's
    concurrency.

    --
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 27, '15 at 3:58a
activeMar 27, '15 at 5:22a
posts5
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase