// panicChild produces a panic after a given time. func panicChild(h *supervisor.Handle, s *starts, t time.Duration) error { s.incr(h) select { case <-h.Terminate(): return nil case <-time.After(t): panic("panic!") } return nil }
// errorChild returns an error after a given time. func errorChild(h *supervisor.Handle, s *starts, t time.Duration) error { s.incr(h) select { case <-h.Terminate(): return nil case <-time.After(t): return fmt.Errorf("error!") } return nil }
// selectChild works in a select loop until terminated. func selectChild(h *supervisor.Handle, s *starts) error { s.incr(h) for { select { case <-h.Terminate(): return nil case <-time.After(10 * time.Millisecond): } } return nil }