Atomically load pool indexes

This commit is contained in:
Aliaksandr Valialkin
2016-06-23 19:20:57 +03:00
parent 5f9190a306
commit c0dd811f50
+2 -1
View File
@@ -29,7 +29,8 @@ type byteBufferPool struct {
}
func (p *byteBufferPool) Acquire() *ByteBuffer {
for _, idx := range p.idxs {
for i := 0; i < steps; i++ {
idx := atomic.LoadUint64(&p.idxs[i])
v := p.pools[idx].Get()
if v != nil {
return v.(*ByteBuffer)