detach

package
v0.5.0-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package detach provides basic blocks for running goroutines with a detached context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Task

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

A Task describes the status of a detached function call started by calling Go.

func Go

func Go(f func(context.Context)) Task

Go starts a new goroutine with a detached context and returns a Task that can be used to cancel and/or wait for the function to return.

func (Task) Cancel

func (t Task) Cancel()

Cancel cancels a Task. After the first call, subsequent calls to Cancel do nothing.

func (Task) Finished

func (t Task) Finished() <-chan struct{}

Finished returns a channel that is closed on the task function completion.

Jump to

Keyboard shortcuts

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