Hi Manlio ,

The select statement will block until one of its cases is executed and in
your program the select statement doesn't have any cas. so it will block
forever and resulting in deadlock


Thanks,
Vikram Ingawale
ph : +91 9766984458


On Wed, Apr 8, 2020 at 9:57 PM Manlio Perillo <manlio.peri...@gmail.com>
wrote:

> On Wednesday, April 8, 2020 at 6:17:59 PM UTC+2, aravind...@gmail.com
> wrote:
>>
>>
>> Hi All,
>>
>> I am not able to understand why this piece of go code  deadlocks.
>> Doesn't empty select{} blocks forever, irrespective of other go routines
>> to wake that up.
>>
>> https://play.golang.org/p/zBWZPjTGYX7
>>
>>
> The error message is very clear:
> "fatal error: all goroutines are asleep - deadlock!"
>
> The problem is that **all** the goroutines are waiting forever.
>
> Manlio
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/2f29cf8f-0e08-4e83-9a05-d6eb7aa4030d%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/2f29cf8f-0e08-4e83-9a05-d6eb7aa4030d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CADuKi9r73RbYWhw5PSrTY0JVCEx5EYV0MrnSNg%2B_Eppy-p2%3DHw%40mail.gmail.com.

Reply via email to