Jingshao

Cancel All goroutines if Any One of Them is Done

In golang, concurrency is implemented with goroutine and we use channels to control them. Often in concurrency programming, you will have a group of goroutines and want to terminate all of them if any one of them stops. For example, you have a goroutine that read from a source and another goroutine write the result to output. If either the reader or the writer is done, you want to terminate the other. Read more →