Signal linux ofSignalHandler

Hi guys,

I’d like to add a check on some closing signals for my program, I did a grep in
libs/openFrameworks/app/ and i found ofSignalHandler which is called in ofInit() with:

 signal(SIGTERM, &ofSignalHandler);
 signal(SIGQUIT, &ofSignalHandler);
 signal(SIGINT,  &ofSignalHandler);
 signal(SIGHUP,  &ofSignalHandler);
 signal(SIGABRT, &ofSignalHandler);

can i add other ofSignalHandler without touching ofInit() of ofMainLoop?

thanks and good day!

OF catches the closing signals to correctly close all open resources in case the window is closed through a signal rather than through the window gui or pressing esc but you can add your own handler instead. Just call signal with your own callback and that will overwrite the OF one

1 Like