Documentation ¶
Index ¶
- func AddAntsFuncPool(name string, p *ants.PoolWithFunc) (topErr error)
- func AddAntsPool(name string, p *ants.Pool) (topErr error)
- func GetAntsFuncPool(name string) (topPool *ants.PoolWithFunc, code int, topErr error)
- func GetAntsPool(name string) (topPool *ants.Pool, code int, topErr error)
- func NewAntsPool(poolName string, n int, options ...ants.Option) (resPool *ants.Pool, topErr error)
- func NewAntsPoolWithFunc(poolName string, n int, f func(interface{}), options ...ants.Option) (resPool *ants.PoolWithFunc, topErr error)
- func WithAntsLogger() ants.Option
- type AntsLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAntsFuncPool ¶
func AddAntsPool ¶
func GetAntsFuncPool ¶
GetAntsFuncPool 根据名称获取已注册协程池 code返回用于附加判断出错时是否因为断言失败,特定情况使用该值
func GetAntsPool ¶
GetAntsPool 根据名称获取已注册协程池 code返回用于附加判断出错时是否因为断言失败,特定情况使用该值
func NewAntsPool ¶
NewAntsPool 创建ans协程池 poolName为空时不放入全局map,当将池子放入全局池map时若map已存在同名池子将返回错误 n为协程数量 使用池子用:resPool.Submit(func() {}) 协程池最好在业务方法开始前就使用NewAntsPoolWithNum生成好,避免在业务中动态生成
func NewAntsPoolWithFunc ¶
func NewAntsPoolWithFunc(poolName string, n int, f func(interface{}), options ...ants.Option) (resPool *ants.PoolWithFunc, topErr error)
NewAntsPoolWithFunc 创建ans业务方法固定的协程池 poolName为空时不放入全局map, n为协程数量,f为业务方法只有接收参数 池子使用:resPool.Invoke(ages) 协程池最好在业务方法开始前就使用NewAntsPoolWithNum生成好,避免在业务中动态生成
func WithAntsLogger ¶
func WithAntsLogger() ants.Option
Types ¶
type AntsLogger ¶
type AntsLogger struct { }
func (*AntsLogger) Printf ¶
func (wl *AntsLogger) Printf(format string, args ...interface{})
Click to show internal directories.
Click to hide internal directories.