package
Version:
v0.9.2
Opens a new window with list of versions in this module.
Published: Mar 29, 2023
License: BSD-3-Clause
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
type Pool struct {
Tasks []*Task
Workers []*Worker
}
A worker group that runs tasks at a configured concurrency.
Run all tasks in the pool and blocks until it's finished.
func (p *Pool) RunBackground()
Run the workers in background.
Stop the background workers.
type Task struct {
Err error
}
Encapsulate a task in a work pool.
func NewTask(f func(data interface{}) error, data interface{}) *Task
type Worker struct {
ID int
}
A worker handles the received tasks.
Start the worker and do the tasks.
func (w *Worker) StartBackground()
Start the worker in background, waiting for tasks.
Stop the background worker.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.