Note that the call to Wait doesn’t just block, it
suspends the current goroutine, allowing other goroutines to run on the OS thread. A
few other things happen when you call Wait: upon entering Wait, Unlock is called on
the Cond variable’s Locker, and upon exiting Wait, Lock is called on the Cond variable’s
Locker. In my opinion, this takes a little getting used to; it’s effectively a hidden side
effect of the method. It looks like we’re holding this lock the entire time while we wait
for the condition to occur, but that’s not actually the case. When you’re scanning
code, you’ll just have to keep an eye out for this pattern.
工具
https://github.com/moovweb/gvm Go version manager
blog
http://www.golangprograms.com
https://medium.com/@thatisuday
https://katherine.cox-buday.com/blog/
https://rakyll.org/archive/
https://medium.com/tag/golang
https://github.com/jbuberel/go-patterns https://gowebexamples.com
https://blog.go-zh.org
http://www.golangbootcamp.com
https://mikespook.com/tag/golang/
https://github.com/EDDYCJY/blog
https://www.alexedwards.net/blog/
https://yourbasic.org/
https://gobyexample.com/
https://draveness.me/
books
http://www.golang-book.com/books/intro
https://github.com/sdcuike/go-books
Online Resources
https://awesome-go.com
https://github.com/jobbole/awesome-go-cn https://github.com/avelino/awesome-go
https://golang.org/ https://golang.org/play https://go.googlesource.com/go https://groups.google.com/group/golang-nuts https://github.com/golang/go/wiki
https://groups.google.com/forum/#!forum/golang-nuts
Cond
Note that the call to Wait doesn’t just block, it suspends the current goroutine, allowing other goroutines to run on the OS thread. A few other things happen when you call Wait: upon entering Wait, Unlock is called on the Cond variable’s Locker, and upon exiting Wait, Lock is called on the Cond variable’s Locker. In my opinion, this takes a little getting used to; it’s effectively a hidden side effect of the method. It looks like we’re holding this lock the entire time while we wait for the condition to occur, but that’s not actually the case. When you’re scanning code, you’ll just have to keep an eye out for this pattern.