0

Im trying to figure out how to find out when all my threads in the queue are done.. when they are done i want to display a MessageBox saying something like "Operation completed".

This is the code i am using to queue my threads:

Smart.STPStartInfo stpStartInfo = new Smart.STPStartInfo();
stpStartInfo.MaxWorkerThreads = Convert.ToInt32(numericUpDown5.Value);
stpStartInfo.MinWorkerThreads = 2;
_smartThreadPool = new Smart.SmartThreadPool(stpStartInfo);

foreach (string item in urlQueue)
{
    _smartThreadPool.QueueWorkItem(
        new Amib.Threading.Func<string, int, int, string, int>(checkURLSmart),
                                item, iia, 5000, kryptonTextBox1.Text);

    iia++;
}

Any ideas how to know when all threads have completed their work?

pb2q
  • 58,613
  • 19
  • 146
  • 147
Jacqueline
  • 481
  • 2
  • 11
  • 20

1 Answers1

0

You can use WaitAll or WaitAny on a SmartThreadPool.

http://www.codeproject.com/Articles/7933/Smart-Thread-Pool#Feature4

Prabhu Murthy
  • 9,031
  • 5
  • 29
  • 36