package xsync
import "gomo.prashantv.com/xstd/xsync"
Package xsync contains functions that extend the functionality of sync.
Index
Types
type Pool
type Pool[T any] struct { New func() T // contains filtered or unexported fields }
Pool is a generic wrapper for sync.Pool.
func (*Pool[T]) Get
func (p *Pool[T]) Get() T
Get returns an element from the underlying pool, see sync.Pool.Get. If the pool returns no element, p.New is returned if set, or a zero value is returned.
func (*Pool[T]) Put
func (p *Pool[T]) Put(x T)
Put adds x to the pool.