taskrunner

package
v0.0.0-...-d6dd603 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2021 License: MIT Imports: 1 Imported by: 2

Documentation

Overview

Package taskrunner contains TaskRunner interface and some implementations.

TaskRunners can be used to control resource usage and implement graceful shutdown.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrClosed is returned when task is submitted after closed.
	ErrClosed = errors.New("TaskRunner: Closed")

	// ErrTooBusy is returned when task is submitted but the task runner is too busy to handle.
	ErrTooBusy = errors.New("TaskRunner: Too busy")
)

Functions

This section is empty.

Types

type TaskRunner

type TaskRunner interface {
	// Submit submits a task to run. The call must not block.
	// Return an error if the task can't be run.
	Submit(task func()) error

	// Close stops the TaskRunner and waits for all tasks finish.
	// Any Submit after Close should return an error.
	Close()
}

TaskRunner is an interface to run tasks.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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