Wait until all threads teminated in ThreadPool

Posted by Neir0 on Stack Overflow See other posts from Stack Overflow or by Neir0
Published on 2010-03-25T23:28:45Z Indexed on 2010/03/25 23:33 UTC
Read the original article Hit count: 395

Filed under:
|

Hi i have this code:

var list = new List<int>();
   for(int i=0;i<10;i++) list.Add(i); 
   for(int i=0;i<10;i++)
   {
 ThreadPool.QueueUserWorkItem(
  new WaitCallback(x => {
  Console.WriteLine(x);  
  }),list[i]);
   } 

And i want to know when all threadpools threads finished their work. How i can to do that?

© Stack Overflow or respective owner

Related posts about c#

Related posts about threadpool