poolKit

package
v3.1.112 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NewAntPool 创建 *ants.Pool 实例.
	/*
	   PS:
	   (1) 通过 Pool.Submit() 执行任务,任务无参无返回值.
	   (2) 默认情况下(即不传options):
	   		(a) (Nonblocking: false) 阻塞模式
	   		(b) (MaxBlockingTasks: 0) 阻塞模式下,最多因为调用Pool.Submit()而阻塞的goroutine数量 不设限制.
	   (3) 可以通过 ants.WithLogger() 指定日志输出(默认输出到控制台);
	   (4) 可以通过 ants.WithPanicHandler() 处理goroutine发生的panic,否则通过Logger输出.

	   @param size 	(1) 如果<=0,生成的池是无限制的;
	   				(2) 即cap;
	   				(3) 并不是传了多少就立即创建多少协程.
	*/
	NewAntPool func(size int, options ...ants.Option) (*ants.Pool, error) = ants.NewPool

	// NewAntPoolWithFunc 创建 *ants.PoolWithFunc 实例.
	/*
	   PS:
	   (1) 通过 Pool.Submit() 执行任务,任务无参无返回值.
	   (2) 默认情况下(即不传options):
	   	(a) (Nonblocking: false) 阻塞模式
	   	(b) (MaxBlockingTasks: 0) 阻塞模式下,最多因为调用Pool.Submit()而阻塞的goroutine数量 不设限制.
	   (3) 可以通过 ants.WithLogger() 指定日志输出(默认输出到控制台);
	   (4) 可以通过 ants.WithPanicHandler() 处理goroutine发生的panic,否则通过Logger输出.

	   @param size 	(1) 如果<=0,生成的池是无限制的;
	   				(2) 即cap;
	   				(3) 并不是传了多少就立即创建多少协程.
	*/
	NewAntPoolWithFunc func(size int, pf func(interface{}), options ...ants.Option) (*ants.PoolWithFunc, error) = ants.NewPoolWithFunc
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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