Yes, exactly. It's a deadlock in the general sense, but this case is
particularly easy to detect: if all of the goroutines in your program
are blocked on some channel operation, then the runtime's scheduler
notices it has nothing it can do and reports that the system has
deadlocked.

-Ian

Quoting diego patricio (2019-01-29 03:59:13)
>    Hi,�  maybe it's because no goroutine read the channel,�  the four
>    value cause the deadlock because for write that value there is no space
>    in the channel,�  sorry by my English, I'm new in go too...�
>
>    El mar., 29 ene. 2019 9:55, ���� <[1]kazya.ito.dr...@gmail.com>
>    escribió:
>
>    I know the general meaning of a deadlock, but I don't know the meaning
>    of a deadlock in golang. For example, I send 4 values to a buffered
>    channel whose maxmum size is 3 and a deadlock occurs. I think this is
>    just "values are out of bounds" like array. What does a deaklock mean
>    in golang?
> func main() {
>    ch1 := make(chan int, 3)
>    ch1<- 10
>    ch1<- 20
>    ch1<- 30
>    ch1<- 40
> }
>
> fatal error: all goroutines are asleep - deadlock!
>
>      --
>      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 [2]golang-nuts+unsubscr...@googlegroups.com.
>      For more options, visit [3]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 [4]golang-nuts+unsubscr...@googlegroups.com.
>    For more options, visit [5]https://groups.google.com/d/optout.
>
> Verweise
>
>    1. mailto:kazya.ito.dr...@gmail.com
>    2. mailto:golang-nuts+unsubscr...@googlegroups.com
>    3. https://groups.google.com/d/optout
>    4. mailto:golang-nuts+unsubscr...@googlegroups.com
>    5. 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to