|
|
|
|
|
by Animats
3899 days ago
|
|
This is much better than the previous Go documentation, particularly in the concurrency area. The previous Go documentation introduced goroutines and channels, stated the mantra "share by communicating, not by sharing", and then gave examples with variables shared between goroutines. It now seems to be recognized that, in Go, if you want to lock shared data, use the lock primitives. Don't try to construct locking primitives from channels; that's error-prone and hard to read. This new manual seems to recognize this. When they want a shared counter, they use a shared counter with traditional locks. |
|
"This approach can be taken too far. Reference counts may be best done by putting a mutex around an integer variable, for instance."
https://web.archive.org/web/20091113154825/http://golang.org...