The following sequence should not hang forever anymore: TerminateThread(thread, 0); WaitForSingleObject(thread, INFINTE);