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 ¶
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.