var mu sync.RWMutex
//goroutine 1
go func() {
mu.Lock()
defer mu.Unlock()
//something else
}()
//goroutine 2
go func() {
mu.Lock()
defer mu.Unlock()
//something else
}()
//goroutine 3
go func() {
mu.RLock()
defer mu.RUnlock()
//something else
}()
//goroutine 4
go func() {
mu.RLock()
defer mu.RUnlock()
//something else
}()
goroutine 1 now get the lock, goroutine 2,3,4 blocked. when goroutine 1 release the lock, which goroutine will be waked up first? Randomly?