In Go, can we synchronize each key of a map using a lock per key? Is map level global lock always required? The documentation says that any access to map is not thread safe. But if a key exists, then can it be locked individually?
2条回答 默认 最新
dseomy1964 2016-11-12 08:12关注Not exactly, but if you are only reading pointers off a map and modifying the referents, then you aren't modifying the map itself.
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报