Summary
In this chapter, you’ve learned how to create production-ready concurrent code, how to handle race conditions, and how to make sure that your code is concurrent-safe. You’ve learned how to use channels to make your Goroutines communicate with each other and how to stop their executions using a context.
You’ve worked on several techniques to handle concurrent computation and learned about sync.Cond
and sync.Map
as powerful tools in your toolbelt for concurrent programming In many real-life scenarios, you might just use functions and methods that handle concurrency for you, especially if you’re doing web programming, but there are cases where you must handle work coming from some different sources by yourself. You need to match requests with your response through different channels. You might need to gather different data into one single Goroutine from different ones. With what you’ve learned here, you’ll be able to do all that. You...