Loading

合集-Golang源码

摘要:源码 // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LI 阅读全文
posted @ 2024-06-23 11:12 Duancf 阅读(46) 评论(0) 推荐(0)
摘要:概括 sync.Map的实现原理可概括为: 通过 read 和 dirty 两个字段将读写分离,读取时会先查询 read,不存在再查询 dirty,写入时则只写入 dirty,所以read相当于dirty的缓存。 读取 read 并不需要加锁,而读或写 dirty 都需要加锁。 misses 字段统 阅读全文
posted @ 2024-06-23 11:16 Duancf 阅读(103) 评论(0) 推荐(0)
摘要:sync.once 阅读全文
posted @ 2024-07-12 14:23 Duancf 阅读(10) 评论(0) 推荐(0)