Van Tran

19%
Flag icon
Here we call Add with an argument of 1 to indicate that one goroutine is beginning. Here we call Done using the defer keyword to ensure that before we exit the goroutine’s closure, we indicate to the WaitGroup that we’ve exited. Here we call Wait, which will block the main goroutine until all goroutines have indicated they have exited.
Concurrency in Go: Tools and Techniques for Developers
Rate this book
Clear rating
Open Preview