< Back
Page 6 of 6
This chapter is from the book
Summary
In this chapter, we took a look at just a few of the synchronization types and functions in Go. First, we explored how to use a sync.WaitGroup to wait for a number of goroutines to finish. Then we explained how to use sync.ErrGroup to wait for a number of goroutines to finish and return an error if any of them failed. Next, we discussed how to use sync.Mutex and sync.RWMutex to synchronize access to a shared resource. Finally, we covered how to use sync.Once to ensure a function is only executed one time.
< Back
Page 6 of 6