dpqy77560 2016-11-12 05:54
浏览 19
已采纳

在Go中,我们可以使用每个键的锁定来同步地图的每个键吗?

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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?