1 Star 0 Fork 0

rocket-booster/go-stl-deque

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
chunkPool.go 301 Bytes
一键复制 编辑 原始数据 按行查看 历史
gengbing 提交于 2019-02-11 15:41 . chunkPool is now a standalone struct
package deque
import (
"sync"
"sync/atomic"
)
type chunkPool struct {
sync.Pool
numChunksAllocated int64
}
func newChunkPool(newChunk func() interface{}) *chunkPool {
var x chunkPool
x.New = func() interface{} {
atomic.AddInt64(&x.numChunksAllocated, 1)
return newChunk()
}
return &x
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/rocket-booster/go-stl-deque.git
git@gitee.com:rocket-booster/go-stl-deque.git
rocket-booster
go-stl-deque
go-stl-deque
master

搜索帮助