I have the following program. The program is processing network packets at 1 Gbps rate. I don't want to print the rate for every packet. Instead, I'd like to save the rate in an array and dump the array on Ctrl-c of the program. When I dump the array on Ctrl-c, the data is all zeroes. Please see "<===" in the program below. Anything else one could do?
Thanks. -Hemant func main() { const SZ = 65536 var time_array [SZ]float64 c := make(chan os.Signal) signal.Notify(c, os.Interrupt, syscall.SIGTERM) go func() { <-c fmt.Printf("You pressed ctrl + C. User interrupted infinite loop.") fmt.Printf("%v ", time_array); <=== all zeroes printed. os.Exit(0) }() i := 0 for { ... time_array[i] = rate fmt.Printf("%f bps ", rate) <=== value printed is correct. i++ } } -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.