I'm writing a daemon in D on linux. I need to be able to stop (kill) it. The traditional C method is a signal handler. I can do this, but I can't figure out how to get the handler to do anything to tell the rest of the daemon to quit.

In a C++ handler, I closed the files that were open, removed a PID file and exited. Nothing complicated in the job. It was more complicated in the implementation - I did a longjump from the signal handler to execute the cleanup code.

I would love to setup "std.signals" classes and from the "core.stdc.signal" signal handler call "std.signals" emit() to trigger the "std.signals" observer.

Is there a canonical D way of catching a SIGTERM and unwinding everything?

RC

Reply via email to