Writing any code in a signal handler besides setting a flag is a very bad idea, specially when writing code across UNIX compliant OSes.<p>Unless it changed, POSIX gives no guarantees of stack size and function calls re-entrancy guarantees depend a lot on the OS and compiler versions.<p>Hence the best approach in managed system languages is just to mark a signal as active and re-trigger it outside the handler when control gets back to user space.