Documentation ¶
Index ¶
- Constants
- Variables
- func AppendPanicHandler(r PanicRecover)
- func Cap() int
- func Free() int
- func Release()
- func Runnable(r Runner) error
- func Running() int
- func Submit(task f) error
- type Job
- type PanicRecover
- type Pool
- func (p *Pool) AppendPanicHandler(recover PanicRecover)
- func (p *Pool) Cap() int
- func (p *Pool) DeleteJob(tag string)
- func (p *Pool) FreeJobCount() int
- func (p *Pool) ReSize(size int)
- func (p *Pool) Release() error
- func (p *Pool) Runnable(r Runner) error
- func (p *Pool) RunningJobCount() int
- func (p *Pool) Submit(task f, tag ...string) error
- type RestartPanicRecover
- type Runner
- type Worker
Constants ¶
View Source
const ( // DefaultAntsPoolSize is the default capacity for a default goroutine pool. DefaultAntsPoolSize = math.MaxInt32 // DefaultCleanIntervalTime is the interval time to clean up goroutines. DefaultCleanIntervalTime = 5 )
Variables ¶
View Source
var ( ErrInvalidPoolSize = errors.New("invalid size for pool") ErrInvalidPoolExpiry = errors.New("invalid expiry for pool") ErrPoolClosed = errors.New("this pool has been closed") )
Errors for the Ants API.
Functions ¶
func AppendPanicHandler ¶
func AppendPanicHandler(r PanicRecover)
Types ¶
type PanicRecover ¶
PanicHandler 线程池 Panic 处理器
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool accept the tasks from client,it limits the total of goroutines to a given number by recycling goroutines.
func NewTimingPool ¶
NewTimingPool generates an instance of ants pool with a custom timed task. (如果协程一定时间没有任务则杀掉自己)
func (*Pool) AppendPanicHandler ¶
func (p *Pool) AppendPanicHandler(recover PanicRecover)
func (*Pool) FreeJobCount ¶
Free returns the available goroutines to work.
func (*Pool) RunningJobCount ¶
Running returns the number of the currently running goroutines.
type RestartPanicRecover ¶
type RestartPanicRecover struct { N int // contains filtered or unexported fields }
func (*RestartPanicRecover) Handle ¶
func (self *RestartPanicRecover) Handle(err error, w *Worker)
Click to show internal directories.
Click to hide internal directories.