executing ASOC code on an abnormal termination

I am writing some an ASOC application. In the process, I mount a volume. On normal termination, I unmount this volume. In the case of an abnormal termination, whether that be the application crashes or the user forces quits, i would like to run a bit of ASOC code that unmounts the volume. Any ideals?

Okay,

After a few minutes of research, I see I have to set up an exception handler and call NSSetUncaughtExceptionHandler within my applicationDidFinishLaunching code. I imagine my NSUncaughtExceptionHandler will have to be on objc code, correct?

If that is so, I haven’t done much ASOC code and even less objc code. Would I sub-class NSapp and add another member and method to set the mounted volume name?

Hi,

in case of force quit the app will be terminated immediately. There is no time to perform clean up routines.
the only way to accomplish this reliably is a helper app or CLI and kqueues, which is described in Observing Process Lifetimes Without Polling