Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalPool ¶
type LocalPool struct {
// contains filtered or unexported fields
}
LocalPool is an thread local object pool. It's similar to sync.Pool but has some difference - It can define the size of the pool. - It never get GCed.
func NewLocalPool ¶
func NewLocalPool(sizePerProc int, newFn func() interface{}, resetFn func(obj interface{})) *LocalPool
NewLocalPool creates a pool. The sizePerProc is pool size for each PROC, so total pool size is (GOMAXPROCS * sizePerProc) It can only be used when the GOMAXPROCS never change after the pool created. newFn is the function to create a new object. resetFn is the function called before put back to the pool, it can be nil.
Click to show internal directories.
Click to hide internal directories.