// watchMaster to monitor if master dead
watchMaster to monitor if master dead
// watchMaster to monitor if master dead
func (w *worker) watchMaster() error {
	for {
		if os.Getppid() == 1 {
			fmt.Printf("master dead, stop worker\n")
			w.stop()
			break
		}
		time.Sleep(w.opt.watchInterval)
	}
	w.stopCh <- struct{}{}
	return nil
}
func ( w * worker ) watchMaster ( ) error { for { if os . Getppid ( ) == 1 { fmt . Printf ( " \n " ) w . stop ( ) break } time . Sleep ( w . opt . watchInterval ) } w . stopCh <- struct { } { } return nil }
watchMaster to monitor if master dead
watchMaster to monitor if master dead
// if parent id change to 1, it means parent is dead