insd::Exit exception class

This class is designed to be thrown as an exception from within the server process. It provides a way to quit the server process that is more graceful than the standard C exit(int) function defined in cstdlib.

The constructor takes one integer argument and if you throw an instance of it from within your server process (and don't catch it elsewhere), your server process will quit with that error number.

Throwing insd::Exit(int) will cause your program to pop each function off the execution stack and call destructors on local variables accordingly. Calling exit(int) will not. Insd doesn't mind either way and will clean up the pidfile in either case.

You should not attempt to catch the insd::Exit exception unless you have a good reason to do so. The effect of catching it is to cancel the process termination. For the sake of code clarity, consider throwing a different exception instead if you intend to catch it.

Example

    throw insd::Exit(0); //exit the process normally.