Example #1
0
func sig_abort(dev *rtl.Context) {
	ch := make(chan os.Signal)
	signal.Notify(ch, syscall.SIGINT)
	<-ch
	_ = dev.CancelAsync()
	dev.Close()
	os.Exit(0)
}
Example #2
0
func async_stop(dev *rtl.Context, c chan bool) {
	<-c // async-read done signal

	log.Println("Received async-read done, calling CancelAsync\n")
	if status := dev.CancelAsync(); status != rtl.Success {
		log.Println("CancelAsync failed\n")
	} else {
		log.Println("CancelAsync successful\n")
	}

	os.Exit(0)
}
Example #3
0
func sig_abort(dev *rtl.Context) {
	//Make a Channel of os.Signal objects
	ch := make(chan os.Signal)
	signal.Notify(ch, syscall.SIGINT)
	//Wait for the Channel to return something.  Discarding
	//the retruned value since we know it's SIGINT
	<-ch
	log.Printf("SIGINT signal received!\n")
	//This code will execute after SIGINT is returned
	_ = dev.CancelAsync()
	dev.Close()
	os.Exit(0)
}