NewPoolAt returns a PoolAt(), it's backed by a sync.Pool so its safe for concurrent use. Get() and Put() errors will always be nil. It will not work with gob.
(New func() BufferAt)
| 24 | // Get() and Put() errors will always be nil. |
| 25 | // It will not work with gob. |
| 26 | func NewPoolAt(New func() BufferAt) PoolAt { |
| 27 | return &poolAt{ |
| 28 | poolAt: sync.Pool{ |
| 29 | New: func() interface{} { |
| 30 | return New() |
| 31 | }, |
| 32 | }, |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | func (p *poolAt) Get() (BufferAt, error) { |
| 37 | return p.poolAt.Get().(BufferAt), nil |
searching dependent graphs…