Did you explicitly lock the initial OS thread, aka M0, to the main/initial 
go routine by calling runtime.LockOSThread() from main or an init func? I 
suspect you were lucky in the past, but I might be wrong. 

On Saturday, September 30, 2023 at 5:20:47 AM UTC+2 Kurtis Rader wrote:

> 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/f3653447-baff-4afc-8747-9d47bc332befn%40googlegroups.com.

Reply via email to