background

package
v0.0.0-...-c932e67 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package background implements functions to execute tasks in a separate goroutine.

Index

Constants

This section is empty.

Variables

View Source
var ErrTerminated = errors.New("worker: terminated")

Functions

This section is empty.

Types

type Worker

type Worker[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](ctx context.Context, n int, fn func(context.Context, T)) (*Worker[T], func())

New returns a new background manager.

func (*Worker[T]) Send

func (w *Worker[T]) Send(vs ...T) error

Send sends a new message to the channel.

Jump to

Keyboard shortcuts

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