<Back
Page 6of 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 async.WaitGroupto wait for a number of goroutines to finish. Then we explained how to usesync.ErrGroupto wait for a number of goroutines to finish and return an error if any of them failed. Next, we discussed how to usesync.Mutexandsync.RWMutexto synchronize access to a shared resource. Finally, we covered how to usesync.Onceto ensure a function is only executed one time.
<Back
Page 6of 6