package gui import ( "time" "go.wit.com/log" ) var watchtime time.Duration = 100 // in tenths of seconds /* This program sits here. This goroutine can be used like a watchdog timer TODO: handle toolkit panics here? */ func Watchdog() { var i = 1 // check the four known things to see if they are all WORKING myTicker(10*time.Second, "WATCHDOG", func() { i += 1 log.Log(INFO, "myTicker() ticked", i) me.rootNode.ListToolkits() }) } func myTicker(t time.Duration, name string, f func()) { ticker := time.NewTicker(t) defer ticker.Stop() done := make(chan bool) /* go func() { time.Sleep(10 * time.Second) done <- true }() */ for { select { case <-done: log.Log(WARN, "myTicker() Watchdog Done!") return case t := <-ticker.C: log.Log(INFO, name, "Current time: ", t) f() } } }