task

package
v0.18.0-rc.9 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

WARNING: this package is EXPERIMENTAL and may change in breaking ways

tasks are basically wrappers around go routines that will send exits if the specified action is given.

The process traps exits and will call the [cleanup] function before it exits. this makes it a nice fit for things like [net/http.Server]s that generally block a thread but also can be closed using a pointer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(self erl.PID, taskFun func() error, cleanupFun func() error, opts ...StartOpt) (erl.PID, error)
func StartLink(self erl.PID, taskFun func() error, cleanupFun func() error, opts ...StartOpt) (erl.PID, error)

func StartMonitor

func StartMonitor(self erl.PID, taskFun func() error, cleanupFun func() error, opts ...StartOpt) (erl.PID, erl.Ref, error)

func Stop

func Stop(task erl.PID) error

Types

type StartOpt

type StartOpt func(opts taskOpts) taskOpts

func SetName

func SetName(name erl.Name) StartOpt

type Task

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

func (*Task) Receive

func (t *Task) Receive(self erl.PID, inbox <-chan any) error

Jump to

Keyboard shortcuts

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