How to wait until a thread dies in Windows? This is what I want my code to look like this:
main thread: creating thread: thread1 waiting for thread1 to die //rest of the code
I am using the Win32 API.
It's easy: WaitForSingleObject can block the current thread, given a different thread descriptor.
void Thread1Proc() { HANDLE hThread2 = CreateThread(...); WaitForSingleObject(hThread2, INFINITE); // by now thread #2 is over }
Source: https://habr.com/ru/post/921954/More articles:gridView.DataSource as a DataTable sets to null in asp.net - c #Frequency of polling on the server from the server - androidSee Action Bar in all actions - Android - androidRunning code again and again - javaI donβt understand why DATEADD does not increase time - datetimeAzure ACS - Relaying Party app - ReturnURL with parameters? - azureSymfony2 & Twig: display all fields and keys - symfonyUnified intent URI? - androidCalculate current / cumulative cost of an instance of an EC2 location - amazon-ec2Security Bcrypt - phpAll Articles