Thread[] threads = new Thread[30];
ManualResetEvent[] events = new ManualResetEvent[10];
for (int i = 0; i < threads.Length; i++)
{
events[i] = new ManualResetEvent(false);
threads[i] = new Thread(worker(events[i])); // call events[i].Set() when the task is done.
threads[i].Start();
}
WaitHandle.WaitAll(events);
或者
for (int i = 0; i < threads.Length; i++)
{
threads[i].Join();
}