Re: [go-nuts] Re: Is this bad concurrency?

2017-08-18 Thread Josh Humphries
There's not a way to terminate a goroutine. But you can create a context with cancellation. Each goroutine would need to periodically check context.Err() and exit on its own. When you exit, you cancel the context. You could combine this with a WaitGroup in order to not exit until all other

[go-nuts] Re: Is this bad concurrency?

2017-08-18 Thread bill . warner
Thanks to both for replying. Both pieces of advice cover the use case of waiting for all goroutines to complete before exiting. I have the opposite problem. I want to end all goroutines if I exit. Is there anything in the sync package for that? On Friday, August 18, 2017 at 2:40:39 PM UTC-4,