摘要: package main import ( "fmt" "sync" ) type object interface{} type Set struct { m map[object]bool sync.RWMutex //线程安全实现,记录下 } //初始化 func New() *Set { return &Set{ m: map... 阅读全文
posted @ 2019-05-17 17:18 wujf 阅读(860) 评论(0) 推荐(0) 编辑
摘要: 方式一 方式二 阅读全文
posted @ 2019-05-17 16:19 wujf 阅读(5980) 评论(0) 推荐(0) 编辑
摘要: package main import ( "fmt" "math/rand" ) func main() { ch := make(chan int) done := make(chan bool) f := make(chan bool) go func() { for { select { ... 阅读全文
posted @ 2019-05-17 16:17 wujf 阅读(512) 评论(0) 推荐(0) 编辑