I have created an array of threads and started all of them. How to know whether all threads have completed work. I don’t want to use thread.wait or thread.join.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well, you can test
Thread.IsAlive– but that will be out of date as soon as you’ve tested it, of course. You could keep a list of “currently alive” threads, and remove them one at a time when they stop, sleeping between test runs. For more detailed information you can useThread.ThreadState.What’s the bigger picture here? What are you trying to achieve, and why don’t you want to call
Thread.Join(potentially with a timeout)?