You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best
What did you expect to see?
Out 0
Out 1
Out 2
Out 3
Out 4
In 0
In 1
In 2
In 3
In 4
Out 5
Out 6
Out 7
Out 8
Out 9
In 5
In 6
In 7
In 8
In 9
Out 10
Out 11
Out 12
Out 13
Out 14
In 10
In 11
In 12
In 13
In 14
What did you see instead?
Out 0
Out 1
Out 2
Out 3
Out 4
Out 5
Out 6
In 0
In 1
In 2
In 3
In 4
In 5
In 6
Out 7
Out 8
Out 9
Out 10
Out 11
Out 12
Out 13
In 7
In 8
In 9
In 10
In 11
In 12
In 13
Out 14
In 14
Try setting the buffer size to 0 and you will observe that the buffer has the size 2. I think that the real buffer size of this definition : ch := make(chan int, N) is N+2
It is normal ? or an issue ?
The text was updated successfully, but these errors were encountered:
enimiste
changed the title
Buffered channels
Buffer size in channels : N+2 instead of N in make(chan int, N)
Nov 21, 2017
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go1.9 windows/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?Windows 10 64bits
What did you do?
https://play.golang.org/p/9lzcI2y9Za
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best
What did you expect to see?
Out 0
Out 1
Out 2
Out 3
Out 4
In 0
In 1
In 2
In 3
In 4
Out 5
Out 6
Out 7
Out 8
Out 9
In 5
In 6
In 7
In 8
In 9
Out 10
Out 11
Out 12
Out 13
Out 14
In 10
In 11
In 12
In 13
In 14
What did you see instead?
Out 0
Out 1
Out 2
Out 3
Out 4
Out 5
Out 6
In 0
In 1
In 2
In 3
In 4
In 5
In 6
Out 7
Out 8
Out 9
Out 10
Out 11
Out 12
Out 13
In 7
In 8
In 9
In 10
In 11
In 12
In 13
Out 14
In 14
Try setting the buffer size to 0 and you will observe that the buffer has the size 2. I think that the real buffer size of this definition :
ch := make(chan int, N)
isN+2
It is normal ? or an issue ?
The text was updated successfully, but these errors were encountered: