B
Brian Stoop
I have several Threads that start other Threads like this:
ThreadA
{
for (int i=0; i <10; i++)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(TestThread1),
(object)i);
}
// Wait for all TestThread1 to terminate before proceeding ??????
}
ThreadB
{
for (int i=0; i <10; i++)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(TestThread2),
(object)i);
}
// Wait for all TestThread2 to terminate before proceeding ??????
}
--------------------------------------------------------------------------------------------------
The TestThread1 and TestThead2 methods have as a randon sleep up to 30
seconds before terminating.
How can I tell when all the ThreadA ThreadPool requests have completed ?
thanks B
ThreadA
{
for (int i=0; i <10; i++)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(TestThread1),
(object)i);
}
// Wait for all TestThread1 to terminate before proceeding ??????
}
ThreadB
{
for (int i=0; i <10; i++)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(TestThread2),
(object)i);
}
// Wait for all TestThread2 to terminate before proceeding ??????
}
--------------------------------------------------------------------------------------------------
The TestThread1 and TestThead2 methods have as a randon sleep up to 30
seconds before terminating.
How can I tell when all the ThreadA ThreadPool requests have completed ?
thanks B