workerpool

package
v0.0.0-...-71b52ef Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Process

func Process(workerID int, t *Task)

Types

type Pool

type Pool struct {
	Tasks []*Task
	// contains filtered or unexported fields
}

func NewPool

func NewPool(tasks []*Task, concurrency, totalTasks int) *Pool

NewPool creates a new pool

func (*Pool) Run

func (p *Pool) Run()

type Task

type Task struct {
	ID   int
	Err  error
	Data interface{}
	// contains filtered or unexported fields
}

Task source reference https://github.com/Joker666/goworkerpool/blob/main/workerpool/task.go

func NewTask

func NewTask(f func(interface{}) error, data interface{}, ID int) *Task

type Worker

type Worker struct {
	ID int
	// contains filtered or unexported fields
}

Worker source reference https://github.com/Joker666/goworkerpool/blob/main/workerpool/worker.go

func NewWorker

func NewWorker(channel chan *Task, ID int) *Worker

func (*Worker) Start

func (wr *Worker) Start(wg *sync.WaitGroup)

Jump to

Keyboard shortcuts

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