Alt-f4 close with multiple threads

Hi, just confirming, does alt f4 completely destroy the process (and all threads)? or is there some cases where if a thread that is not the main thread is stuck in an infinite loop, the program won’t close properly?

Thanks,
roland

If you make all threads deamon, they always close when the main thread is closed.
But when you close an process, i guess all associated threads are closed anyways.

Thanks :slight_smile:

Alt-F4 on what? If you mean on a JFrame for example, then not necessarily unless you explicitly set the default close operation to call System.exit() - see http://docs.oracle.com/javase/7/docs/api/javax/swing/JFrame.html#setDefaultCloseOperation(int). Anything else, depends on what toolkit you’re using. Implicitly or explicitly calling System.exit() should destroy everything.

Alt-f4 sends a close request message to the active window. That is handled by the operating system. The program that owns that window can ignore the message, close the window, ask the user if they really want to close something, or do something else entirely. Then the program has to clean things up behind the scenes even if the window disappears. So obviously alt-f4 cannot do anything disruptive on its own or automatically do anything.