Mutex
A mutex is a synchronization primitive that allows only one goroutine at a time to access a protected section of code. In Go, sync.Mutex provides Lock and Unlock methods for coordinating access to shared mutable state.
Minimal example
var mu sync.Mutex
var count int
func increment() {
mu.Lock()
defer mu.Unlock()
count++
}