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

Method Start

chapter7/patterns/runner/runner.go:52–70  ·  view source on GitHub ↗

Start runs all tasks and monitors channel events.

()

Source from the content-addressed store, hash-verified

50
51// Start runs all tasks and monitors channel events.
52func (r *Runner) Start() error {
53 // We want to receive all interrupt based signals.
54 signal.Notify(r.interrupt, os.Interrupt)
55
56 // Run the different tasks on a different goroutine.
57 go func() {
58 r.complete <- r.run()
59 }()
60
61 select {
62 // Signaled when processing is done.
63 case err := <-r.complete:
64 return err
65
66 // Signaled when we run out of time.
67 case <-r.timeout:
68 return ErrTimeout
69 }
70}
71
72// run executes each registered task.
73func (r *Runner) run() error {

Callers 1

mainFunction · 0.80

Calls 1

runMethod · 0.95

Tested by

no test coverage detected