Alanxtl commented on PR #3437:
URL: https://github.com/apache/dubbo-go/pull/3437#issuecomment-4910952877

   RegistryCodec 在生产代码中只有一个调用者,位于 protocol/dubbo/dubbo_codec.go:46-49 的 init() 
函数里。Go 语言规范保证所有 init() 在 main() 之前串行执行完毕,所以到运行时任何 GetCodec 调用发生的时候,map 
写入早已完成,且此后不再有任何写入。
   GetCodec 的两个调用点(getty_server.go:147 的 NewServer、getty_client.go:187 的 
Connect)虽然可能被并发调用,但 Go map 的并发读是安全的 —— 只有 并发读 + 写 才会触发 
panic。因此,在当前生产代码中,不存在数据竞态。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to