On Wednesday, 13 June 2018 at 12:59:27 UTC, Kagamin wrote:
On Wednesday, 13 June 2018 at 02:02:54 UTC, wjoe wrote:
it is possible to install a signal handler for almost every
signal on POSIX, including segfault. The only signal you can't
catch is signal 9 - sigkill if memory serves.
So I could for instance install a clean up handler on a
segfault via memset, or a for loop, and then terminate.
What will you do with this?
https://github.com/dlang/druntime/blob/master/src/core/internal/abort.d
Are you asking what I would do in case sigabrt is received by my
program instead of sigsegv ?
I would install the same cleanup functionality in this handler.
Zero out memory, send a signal to stop an engine or whatever
mandatory clean up is required and return from the handler. Then
let the OS take care of the rest, i.e. terminate the process.