sync.WaitGroup waits for a set of goroutines. sync.Mutex and RWMutex protect shared state, always unlocked with defer. sync.Once guarantees one-time initialisation, and atomic operations handle simple counters more cheaply than a mutex.
← Go theorytheory 0/50 · 0%
Concurrency · medium
24. sync Package
WaitGroup, Mutex and Once.
Check your understanding
1. Which type waits for goroutines to finish?
2. Mutex unlocking is usually paired with…