In this example, we have a *worker*. The idea here is simulate clean 
shutdown of all go routines based on a condition.

In this case, go routines get spun - based on workers count. Each go 
routine reads the channel, does some work and sends output to the 
outputChannel.

The main go routine reads this output and prints it. To simulate a stop 
condition, the doneChannel is closed. Expected outcome is that select inside 
each go routine will pick this up and execute return which in turn will 
call the defer println. The actual output is that it never gets called and 
main exits.

Not sure what's the reason behind this.

Code at *https://go.dev/play/p/-R7Llw9X_6U *

Can you please help to figure out the bug in this code.

-- 
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/3762b074-63c5-407e-9515-6833465dc94en%40googlegroups.com.

Reply via email to