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.
Click to show internal directories.
Click to hide internal directories.