We are embedding Julia in a larger software suite on Linux/MacOS/Windows.
This existing software makes use of some signal handlers and where it doesn’t some users expect behaviours such as Ctrl-C to interrupt to work.
When integrating Julia with jl_init_with_image if I specify
jl_options.handle_signals = JL_OPTIONS_HANDLE_SIGNALS_OFF;
then this certainly on linux and windows seems to leave the signal handlers alone
however when testing on MacOS the signal handlers get set to a SIG_IGN value even though JL_OPTIONS_HANDLE_SIGNALS_OFF is selected and so no longer have an effect.
Looking deeper it seems that the call to restore_signals is causing this behaviour.
Specifically both starting the signals_thread and setting sigprocmask seem problematic.
Also, as far as I can tell the linux manpage says that sigprocmask has undefined behaviour in a threaded process, which is intrinsically violated by the creation of the signals_thread? sigprocmask(2) - Linux manual page
What is the intended behaviour?
What is the utility of restore_signals?
Would it be possible/sensible to also only call this function?
if (jl_options.handle_signals == JL_OPTIONS_HANDLE_SIGNALS_ON) {
restore_signals();
}
Thanks for any insight you can provide.