Hi all,

We observe at least 10ms delay before receiving message from closed
buffered channel. We met this when we run some code basically like this:

chs := make([]chan struct{}, 10000)
// init
for i := range chs {
   chs[i] = make(chan struct{}, 1)
// close
for _, ch := range chs {
// receive
for _, ch := range chs {
   select {
   case <-ch:
   case <-time.After(10 * time.Millisecond):

The test environment is under --cpu 4 --race on travis(2 bursted cpu) when
running `go test` for the whole test set. After I adjust the timeout to 1s,
I didn't observe this behavior anymore. Is this behavior expected?

I check the spec, which says that `After calling close, and after any
previously sent values have been received, receive operations will return
the zero value for the channel's type without blocking.`

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 | 1 of 7 | next ›
Discussion Overview
groupgolang-nuts @
postedJun 24, '15 at 9:27p
activeJun 25, '15 at 10:13p



site design / logo © 2021 Grokbase