package npool import ( "github.com/panjf2000/ants/v2" "math" ) var antsPool *ants.Pool func init() { antsPool, _ = ants.NewPool(math.MaxInt32) } func InitPool(config Config) { antsPool, _ = ants.NewPool(config.PoolSize, ants.WithOptions(config.Options())) } func Submit(task func()) error { return antsPool.Submit(task) } func Running() int { return antsPool.Running() } func Cap() int { return antsPool.Cap() } func Free() int { return antsPool.Free() } func Release() { antsPool.Release() } func Reboot() { antsPool.Reboot() }