Can exception/error in one thread halt the whole application? Can exception/error in one thread halt the whole application? multithreading multithreading

Can exception/error in one thread halt the whole application?


If an error / exeption is thrown in a thread (not a main one) can this halt the whole application ?

It will if it causes the only non-daemon thread to return from run()

If there are other non-daemon threads running or the exception or error is caught and handled, the application will keep running.

will this just stop the thread it was running in ?

if the exception or error is caught and handled it might not stop any threads.


In addition to Peter Lawrey's answer, there's one more case when unhandled exception can cause application freeze: if died thread had grabbed some lock needed by other threads of program.