I am going to retract this pull request because SIGINT handling is broken inside of SDL2::Event.wait.
I went source diving to see how to implement correct handling, and I have narrowed down on this issue
SDL_Init() calls into SDL_QuitInit (in SDL_quit.c) which only installs appropriate signal handlers if they are set to SIG_DFL. Ruby's SIGINT handler is not ideal because it will not raise interrupt from within C code.
But all that is moot because SDL_WaitEvent (in SDL_events.c) is implemented as a poll and sleep loop (yikes!), so it would be far easier to implement the same loop in ruby than to orchestrate the necessary signal handler installation dance required to make the SDL and ruby handlers coexist.
I am going to retract this pull request because SIGINT handling is broken inside of SDL2::Event.wait.
I went source diving to see how to implement correct handling, and I have narrowed down on this issue SDL_Init() calls into SDL_QuitInit (in SDL_quit.c) which only installs appropriate signal handlers if they are set to SIG_DFL. Ruby's SIGINT handler is not ideal because it will not raise interrupt from within C code.
But all that is moot because SDL_WaitEvent (in SDL_events.c) is implemented as a poll and sleep loop (yikes!), so it would be far easier to implement the same loop in ruby than to orchestrate the necessary signal handler installation dance required to make the SDL and ruby handlers coexist.