MCPcopy Create free account
hub / github.com/goinaction/code / Runner

Struct Runner

chapter7/patterns/runner/runner.go:14–28  ·  view source on GitHub ↗

Runner runs a set of tasks within a given timeout and can be shut down on an operating system interrupt.

Source from the content-addressed store, hash-verified

12// Runner runs a set of tasks within a given timeout and can be
13// shut down on an operating system interrupt.
14type Runner struct {
15 // interrupt channel reports a signal from the
16 // operating system.
17 interrupt chan os.Signal
18
19 // complete channel reports that processing is done.
20 complete chan error
21
22 // timeout reports that time has run out.
23 timeout <-chan time.Time
24
25 // tasks holds a set of functions that are executed
26 // synchronously in index order.
27 tasks []func(int)
28}
29
30// ErrTimeout is returned when a value is received on the timeout channel.
31var ErrTimeout = errors.New("received timeout")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected