Waiting for multiple threads to finish

  • Thread starter Thread starter Faraz Hussain
  • Start date Start date
F

Faraz Hussain

Dear All,
How can I wait for multiple threads to finish in .Net Compact Framework?

In full .Net Framework we have Thread.join() method which we can call to
wait for the thread to finish but in .Net CF it is simply not available. Can
anyone tell me the alternative of Thread.join() method in .Net CF.

I shall be very thankfull.
regards,
Faraz
 
Hi,

you could perhaps get the thread you're wanting to join with to hold a
mutex that it releases just before it completes. You could then wait on
the mutex to be released.

Not particularly elegant, but it should work :)

Mike
 
Faraz,

You could use a global variable that is incremented as each worker thread
starts and decremented when each thread ends. When it reaches zero, you're
done.
 
Back
Top