mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2024-12-25 14:28:58 +00:00
还有一行英文没删。。
This commit is contained in:
parent
25363e526d
commit
954871d062
@ -44,7 +44,6 @@ func loadIcons() {
|
||||
因此,一个goroutine在检查icons是非空时,也并不能就假设这个变量的初始化流程已经走完了(译注:可能只是塞了个空map,里面的值还没填完,也就是说填值的语句都没执行完呢)。
|
||||
|
||||
最简单且正确的保证所有goroutine能够观察到loadIcons效果的方式,是用一个mutex来同步检查。
|
||||
The simplest correct way to ensure that all goroutines observe the effects of loadIcons is to synchronize them using a mutex:
|
||||
|
||||
```go
|
||||
var mu sync.Mutex // guards icons
|
||||
|
Loading…
Reference in New Issue
Block a user