On Wed, Apr 8, 2020 at 9:17 AM <aravindhank1...@gmail.com> wrote:
>
> 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
>
> Please help me to understand why code is detected as deadlock.
> And When I run this code with go run -race main.go in Linux box(go version 
> go1.13.6 linux/amd64), it prints "received 5" waits forever.
> I expect same to happen, when built and run.
>
> Sorry, if this is already answered, please point me.

Is your question why the behavior is different when you use -race?
The deadlock detection is best-effort; there are many different ways
that it can fail to detect a deadlock.  I expect that -race interferes
with the simple deadlock detection.

Ian

-- 
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/CAOyqgcXPkZZJBqLXHwmebgOdJyc%3DTwR%3D8S-9iTcub0WmXjkkQA%40mail.gmail.com.

Reply via email to