Closed LasseBlaauwbroek closed 1 year ago
Unfortunately I don't think this is so simple. sig_on()
apparently uses setjmp()
and then the signal handler longjmp()
s back to it. This only really works if the C++ code has not done any RAII initialization before the longjmp(). Otherwise, all the necessary cleanup will be skipped. This would lead to a lot of problems when calling into Cap'n Proto / KJ code.
As described in https://github.com/capnproto/capnproto/issues/1542, Pycapnp is having issues with catching signals while executing long-running capnp C++ code, because Python's signal handlers are only executed outside of external code.
Other libraries also seem to have this issue, hence the existence of
cysignals
. I propose that any possibly-long-running C++ code (particularly blocking C++ code) is wrapped in