Chapter 5. Locks, Blocks, and Better Channels
Now that we're starting to get a good grasp of utilizing goroutines in safe and consistent ways, it's time to look a bit more at what causes code blocking and deadlocks. Let's also explore the sync
package and dive into some profiling and analysis.
So far, we've built some relatively basic goroutines and complementary channels, but we now need to utilize some more complex communication channels between our goroutines. To do this, we'll implement more custom data types and apply them directly to channels.
We've not yet looked at some of Go's lower-level tools for synchronization and analysis, so we'll explore sync.atomic
, a package that—along with sync.Mutex
—allows for more granular control over state. ...
Get Go: Building Web Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.