A thread that is continuously executing has an infinite loop. Toterminate that thread you must break that loop by providing asuitable terminating condition. If the thread is a "worker" thread,the main thread should signal all worker threads to terminate whenthe main thread terminates. The main thread should remain activeuntil all worker threads have successfully terminated.