package
Version:
v0.0.9
Opens a new window with list of versions in this module.
Published: Jul 1, 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
¶
* @Date: 2023-07-11 13:55:42
* @LastEditTime: 2023-07-12 14:28:40
* @Description:
Pool ...
func (p *Pool) Do(f func())
Do ...
type Task struct {
F TaskFunc
Args interface{}
}
定义任务实体,里面有方法和参数
func (t *Task) Execute(args ...interface{})
任务执行
type TaskFunc func(args ...interface{})
定义接口 可传任意参数
定义线程池对象
停止执行任务,回收正在执行任务的协程 协程计数器减1 直到变成0退出,否则阻塞
任务调度 go协程从channel里取任务执行Execute方法
Source Files
¶
Click to show internal directories.
Click to hide internal directories.