摘要:
package main import ( "fmt" "sync" ) var n int var lock sync.RWMutex func main() { wg := sync.WaitGroup{} wg.Add(1000) for i:=0; i<1000; i++ { go func 阅读全文
摘要:
阅读全文
摘要:
package main func main() { defer println("defer 1") level1() } func level1() { defer println("defer 2") defer func() { if err := recover(); err != nil 阅读全文
摘要:
package main import "fmt" import "sync" import "time" var oc sync.Once var a int = 5; func main() { go func(){ oc.Do(func(){ a++ }) }() go func(){ oc. 阅读全文