handoff

package
v0.3.28 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package handoff carries what work off the loop makes onto the loop, and accounts for what the loop never takes: once the loop has ended an Invoke is dropped, so a result still in flight at shutdown would otherwise be lost with whatever it holds (an off-heap raster).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handoffs

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

Handoffs tracks the work started through it and the results it handed to the loop that the loop has not taken yet. Its zero value is ready for use. Go and Deliver are safe from any goroutine.

func (*Handoffs) Close

func (h *Handoffs) Close()

Close starts no more work, waits for the work running, and frees every result the loop has not taken, in the order they were delivered. It runs once the loop has ended (or on the loop), so no land runs after it. A second Close does nothing more.

func (*Handoffs) Closed

func (h *Handoffs) Closed() bool

Closed reports whether Close has begun: work still to do is wasted, as nothing will take its result.

func (*Handoffs) Deliver

func (h *Handoffs) Deliver(invoke func(func()), land, free func())

Deliver hands a result to the loop through invoke: land takes it there. When the loop never runs land, because Close began first or the loop ended with it queued, Close runs free instead. Exactly one of land and free runs.

func (*Handoffs) Go

func (h *Handoffs) Go(spawn func(func()), work func()) bool

Go runs work through spawn and reports true, or reports false and runs nothing once Close has begun.

Jump to

Keyboard shortcuts

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