Remove non-exclusive access to ChunkList field

This commit is contained in:
Junegunn Choi 2017-08-02 00:09:00 +09:00
parent 99927c7071
commit a56489bc7f
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -75,6 +75,7 @@ func (cl *ChunkList) Snapshot() ([]*Chunk, int) {
cl.mutex.Lock()
ret := make([]*Chunk, len(cl.chunks))
count := cl.count
copy(ret, cl.chunks)
// Duplicate the last chunk
@ -84,5 +85,5 @@ func (cl *ChunkList) Snapshot() ([]*Chunk, int) {
}
cl.mutex.Unlock()
return ret, cl.count
return ret, count
}