pool

package
v1.0.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ObjPool

type ObjPool struct {
	// contains filtered or unexported fields
}

func NewObjPool

func NewObjPool(new func() typedef.Poolable) *ObjPool

NewObjPool construct a new object pool

func (*ObjPool) Ask

func (o *ObjPool) Ask() typedef.Poolable

func (*ObjPool) Giveback

func (o *ObjPool) Giveback(p typedef.Poolable)

type WorkPool

type WorkPool struct {
	// contains filtered or unexported fields
}

WorkPool is a work pool that bind to some idl goroutines and put task to run.

func NewWorkPool

func NewWorkPool(maxIdle int, maxIdleTime time.Duration) *WorkPool

NewWorkPool construct a new work pool

func (*WorkPool) Submit

func (wp *WorkPool) Submit(t typedef.Task, p interface{})

Submit a task and run

func (*WorkPool) SubmitWait

func (wp *WorkPool) SubmitWait(t typedef.Task, p interface{})

SubmitWait submit the task and wait it util finish

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL