task

package
v0.0.0-...-3ffe1d7 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2024 License: ISC Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StopAll

func StopAll()

StopAll stops all tasks.

Types

type Task

type Task struct {
	// contains filtered or unexported fields
}

A Task is a wrapper around a function that offers scheduling and syncronization.

func New

func New(waitDuration time.Duration, callback func() error) *Task

New makes a new task with the callback.

func (*Task) Context

func (task *Task) Context() context.Context

Context gets the task's context.

func (*Task) Schedule

func (task *Task) Schedule()

Schedule schedules a task for later execution.

func (*Task) Stop

func (task *Task) Stop()

Stop stops a task. This should not be done to stop a single run, but as a way to cancel it forever.

Jump to

Keyboard shortcuts

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