I sometimes use a timer to call System.exit in order to kill my throw-away code snippet after few seconds, which is quite useful in case it eats 100% CPU and Windows gets irresponsible because of this. It's quite handy, except in case I start it in debugger. In debugger I'd like to disable it automatically, otherwise I forget it and my debugged process gets killed. Can I find out if a process was started in debugger?
Note: I know I should not use this for anything serious. I'm not going to.