xpool

package
v0.0.0-...-b804f52 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: MulanPSL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAntsFuncPool

func AddAntsFuncPool(name string, p *ants.PoolWithFunc) (topErr error)

func AddAntsPool

func AddAntsPool(name string, p *ants.Pool) (topErr error)

func GetAntsFuncPool

func GetAntsFuncPool(name string) (topPool *ants.PoolWithFunc, code int, topErr error)

GetAntsFuncPool 根据名称获取已注册协程池 code返回用于附加判断出错时是否因为断言失败,特定情况使用该值

func GetAntsPool

func GetAntsPool(name string) (topPool *ants.Pool, code int, topErr error)

GetAntsPool 根据名称获取已注册协程池 code返回用于附加判断出错时是否因为断言失败,特定情况使用该值

func NewAntsPool

func NewAntsPool(poolName string, n int, options ...ants.Option) (resPool *ants.Pool, topErr error)

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{})

Jump to

Keyboard shortcuts

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