sync.Once: Can defer atomic.StoreUint32(&o.done, 1) be replaced with defer func() {o.done=1}()

后端 未结 0 1316
说谎
说谎 2021-01-28 17:20

While reading the source codes of Go, I have a question about the code in src/sync/once.go:

can we use "defer func() {o.done=1}()" to replace "defer atomic

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