4 ms·
Use atexit to register a handler that setjmps back to main.
by tedunangst 12y ago
Use atexit to register a handler that setjmps back to main.
- cnvogel 12y agoHey, I like that. Always nice to use the more obscure things messing with the stack (set/longjmp) ;-)... Haven't encountered them for a while. http://pastebin.com/2fdwHvi8 http://pastebin.com/2fdwHvi8 [optiplex /home/chris/tmp/atexit_main] $ ./testme This is main. I will sleep a while, then try to exit. PANIC! main() has been restarted due to a unscheduled exit! This is main. I will sleep a while, then try to exit. PANIC! main() has been restarted due to a unscheduled exit! This is main. I will sleep a while, then try to exit. PANIC! main() has been restarted due to a unscheduled exit! This is main. I will sleep a while, then try to exit.