Your deadlock happens because the message channel is not buffered. The jobDispatcher goroutine is blocked waiting for channel to accept msg, while the processPackets packets just sent the shutdown signal and exited (on the time.Ticker branch of the select). A buffer of any size, even 1, would avoid the deadlock as long as you don't modify the rest of your code. BTW, the time.After branch would be triggered after the select has been idle for 60 seconds, which will never happen because of the time.Ticker branch. If you want it to fire after 60s of channel life, create the timeout channel outside the loop, like you did for the time.Ticker channel.
Cheers, Ales On Friday, 20 January 2017 17:10:48 UTC-5, l...@pinkfroot.com wrote: > > Yeah I did try with it enabled and it sees nothing. I use it all the > time, it's great!! > > Thing is I can see the race condition in the code, just trying to work out > how to avoid it! > > On Friday, January 20, 2017 at 10:09:05 PM UTC, Val wrote: >> >> Did you try with the race detector enabled? What was the output? >> If not, you really should, and it's super easy to do. >> Any complain from the race detector is a bug that must be fixed, not a >> mere warning. >> >> Cheers >> Val >> >> On Friday, January 20, 2017 at 8:10:42 PM UTC+1, l...@pinkfroot.com >> wrote: >> >> >>> It is kind of a race condition but one that I don't think will be >>> detected by the detector! >>> >>> -- 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.