I was rewriting a program I originally wrote in Python many years ago that
uses OpenCV. I wanted to make it possible to cleanly terminate the Go
version when SIGINT was sent to the process; e.g., by pressing Ctrl-C. So I
changed how the context was created from this in the main() function:

ctx, cancel := context.WithCancel(context.Background())

to this:

ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT)

However, that appeared to change the thread that subsequent statements
in main()
ran on. I say this because the gocv.NewWindow() function (from package
gocv.io/x/gocv and also executed in main()) started complaining that it was
no longer running on the main thread. The signal package documentation
makes no mention of this side-effect. Am I missing something obvious?
Should I open an issue suggesting this side-effect be explicitly
documented? Or, is this side-effect a bug?

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD8cXNxJ-h0Wes9ocZrng6WWU8Bdveok0yKJX2iGBSbaog%40mail.gmail.com.

Reply via email to