Throw stack trace from program kill
Adam D Ruppe
destructionator at gmail.com
Sun Jan 16 18:26:58 UTC 2022
On Sunday, 16 January 2022 at 18:03:53 UTC, Paul Backus wrote:
> extern(C) void handleCtrlC(int)
> {
> throw new Error("Killed by CTRL+C");
> }
This is really iffy since signals can come to random threads at
random times.
The best thing to do is typically to just set a "user requested
quit" flag from the signal handler and then make sure you check
that periodically in other parts of your program. Then those
other parts can exit gracefully or throw sanely or whatever.
More information about the Digitalmars-d-learn
mailing list