TaskPool

package
v0.0.0-...-b12e7ef Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

* @Author: drowningwhale 351231768@qq.com * @Date: 2023-10-08 13:45:50 * @LastEditors: drowningwhale 351231768@qq.com * @LastEditTime: 2023-10-08 14:06:48 * @FilePath: \go-course\TaskPool\task_pool.go * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE

* @Author: drowningwhale 351231768@qq.com * @Date: 2023-10-08 14:06:48 * @LastEditors: drowningwhale 351231768@qq.com * @LastEditTime: 2023-10-09 12:06:17 * @FilePath: \go-course\TaskPool\task_pool2.go * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Task

type Task func()

type Task2

type Task2 func()

type TaskPool

type TaskPool struct {
	// contains filtered or unexported fields
}

func NewTaskPool

func NewTaskPool(numG int, capacity int) *TaskPool

NewTaskPool创建任务池 numG 是goroutine数量 capacity是缓存的容量

func (*TaskPool) Close

func (p *TaskPool) Close() error

func (*TaskPool) Submit

func (p *TaskPool) Submit(t Task)

type TaskPool2

type TaskPool2 struct {
	Tasks chan Task2
	Close chan struct{}
}

func NewTaskPool2

func NewTaskPool2(numG int, capacity int) *TaskPool2

func (*TaskPool2) Close2

func (p *TaskPool2) Close2() error

func (*TaskPool2) Submit2

func (p *TaskPool2) Submit2(t Task2)

Jump to

Keyboard shortcuts

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