Why mutex is needed to set the fields of Logger struct?

后端 未结 0 850
攒了一身酷
攒了一身酷 2020-12-21 10:21

In the below code from standard library:

type Logger struct {
    mu     sync.Mutex // ensures atomic writes; protects the following fields
    prefix string          


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题