I have a console application that inits 4 theads to perform a long task. I want my program to wait until the threads are complete, and then complete the program execution. Is there a way to stop the program from executing, letting the threads complete their job?
From stackoverflow
-
Threading.Thread.Join is what you are looking for.
Edit: Examples here
-
Depending upon how you're starting the 4 threads then WaitHandle.WaitAll might be a good place to start...
-
Thread.Join is what you want.
-
Load your application after those threads are joined e.g:
Thread1.join(); Thread2.join(); Thread3.join(); Thread4.join(); startApplication();
If you could provide me in more detail i can help you better.
0 comments:
Post a Comment