ARTICLE AD BOX
My application is written in Go, using gotk3 and GTK3. I am using the gotk3 wrapper around glib.timeout_add_seconds_full to update process stats and the time data was last seen in each channel.
This code seems to work as required, but really I would like to be more confident that the map defined prior to calling the timeout will be correctly preserved between calls to the timeout, or should this be a global variable?
func updateStats() { // function to add a glib.timeout() to the main event loop // declare a map to keep track of when data was last seen in each channel lastSn := make(map[int]time.Time) // update stats at 'Stattime' seconds intervals glib.TimeoutSecondsAdd(uint(Stattime), func() bool { // update stats display, update values in lastSn getStats(true, lastSn) return true // rinse & repeat }) return }Explore related questions
See similar questions with these tags.
