package
Version:
v1.2024.116
Opens a new window with list of versions in this module.
Published: Jan 16, 2024
License: MIT
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Goroutine池.
用于goroutine复用,提升异步操作执行效率.
func SetExpire(expire int)
动态改变默认池中goroutine的过期时间
goroutine池对象
创建goroutine池管理对象,给定过期时间(秒)
第二个参数用于限制限制最大的goroutine数量/线程数/worker数量,非必需参数,默认不做限制
func (p *Pool) Add(f func())
添加异步任务
关闭池,所有的任务将会停止,此后继续添加的任务将不会被执行
func (p *Pool) SetExpire(expire int)
动态改变当前池中goroutine的过期时间
Source Files
¶
Click to show internal directories.
Click to hide internal directories.