dcsimg

How can one thread wait for another thread to die before it continues execution?

John Zukowski

The thread's join() method allows you to wait for another thread to finish execution.


Thread t1 = new Thread(runnable);
t1.start();
// do stuff
...
// wait for t1 to finish
t1.join()