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.

Reply via email to