It seems that when BSD signals are converted to thrown exceptions, it only work the first time but not subsequent times.
I tried to convert signals to exception via the following call I made in the main method just before calling NSApplicationMain
:
[[NSExceptionHandler defaultExceptionHandler] setExceptionHandlingMask:NSHandleUncaughtSystemExceptionMask];
This does work the first time a signal
occurred. But the second time it happens, the thread just hangs but still allowing other threads to run. Is there any way I can make this happen each time?
Btw, I tested this by having a button that triggers a SIGSEGV
violation by writing to address zero:
char* p = NULL;
*p = 'x';
What I want is for that to throw an exception every time -- just like Java's NullPointerException
. But currently it only works the first time it is executed, subsequently the thread hangs.