package main import ( "fmt" "sync" "time" ) var l sync.RWMutex var a string = "1" func f() { a = "hello,world" l.Unlock() //l.RUnlock() } func main() { l.Lock() //l.RLock() go f() l.Lock()Lock() //l.URLock() fmt.Println(a) }原文链接:https://www.f2er.com/go/190135.html