Thanks all.

If that is the case, in below code main go routine will a reach a situation
where no other go routines running to wake it up.
But no deadlock is not detected.
https://play.golang.org/p/z1NMYQAi0KY
May I assume deadlock - detection couldn't pick up this scenario?
By using empty select{}, doesn't the coder purposely wishes to block
forever?

Thanks, Aravindhan K




On Wed, Apr 8, 2020 at 10:13 PM 'Vikram Ingawale' via golang-nuts <
golang-nuts@googlegroups.com> wrote:

> 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
> <https://groups.google.com/d/msgid/golang-nuts/CADuKi9r73RbYWhw5PSrTY0JVCEx5EYV0MrnSNg%2B_Eppy-p2%3DHw%40mail.gmail.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/CAJn1S2Ob8R1hW2ix3cp2Sd9FOgzM0jcdEsr97suXshEAHSdtoQ%40mail.gmail.com.

Reply via email to