====== C - C++ Threads - join() ====== **WARNING:** std::thread::join() blocks the calling thread. Calling join on other threads in your __main__ application can cause the application to freeze. A call to **std::thread::join()** blocks until the thread on which join is called, has finished executing. * A join() in the main() will wait for the execution of the spawned threads to finish before it can exit the application. * If join() is not called after creating a thread the main function will not wait for the spawned thread to complete before it tears down the application. * If the application tears down before the spawned thread finishes, it will terminate the spawned thread as well, even if it has not finished executing. * This can leave data in a very inconsistent state and should be avoided at all cost. ---- [[C:C++ Threads:join()|join()]]