task

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Async

func Async(task ITask)

func Run

func Run(task IRunnable)

func RunAsync

func RunAsync(task IRunnable)

func Wait

func Wait(task ITask)

func WaitAll

func WaitAll(tasks []ITask)

Types

type IRunnable

type IRunnable interface {
	Run()
}

type ITask

type ITask interface {
	Async()
	Wait()
}

type Status

type Status int
const (
	StatusNone Status = iota
	StatusRunning
	StatusCompleted
)

type Task

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

func New

func New[T any](f func() T) *Task[T]

func (*Task[T]) Async

func (t *Task[T]) Async()

func (*Task[T]) IsCompleted

func (t *Task[T]) IsCompleted() bool

func (*Task[T]) IsRunning

func (t *Task[T]) IsRunning() bool

func (*Task[T]) Result

func (t *Task[T]) Result() (T, error)

func (*Task[T]) Wait

func (t *Task[T]) Wait()

type Void

type Void int
const VoidResult Void = 0

Jump to

Keyboard shortcuts

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