package
Version:
v0.0.3
Opens a new window with list of versions in this module.
Published: Aug 26, 2024
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
GPool 定义了一个协程池的结构体
NewGPool 创建一个新的 GPool 实例,参数 capacity 指定了协程池的容量
Acquire 获取一个可用的协程,如果获取成功返回 true,否则返回 false
ErrChan 获取错误通道,以便获取协程执行过程中出现的错误
Go 提交一个新的任务到协程池中执行,如果当前没有可用的协程,则任务会被加入到待执行队列中
func (p *GPool) Release()
Release 释放一个协程,供其他任务使用
func (p *GPool) Shutdown()
Shutdown 关闭协程池,等待所有协程执行完毕,并关闭错误通道
Source Files
¶
Click to show internal directories.
Click to hide internal directories.