0
Answer

ThreadPooling and c#

Ask a question
programmers

programmers

18y
1.8k
1
I have to upload 70 files using ThreadPooling and the code i have used is as below.I have set the maxthread size as 10.But it is uploading only 8 files.

Please tell me how to make it work.Also if u can please give a sample code.Help will be greatly appreciated.

 

WaitCallback callBack = new WaitCallback(UploadFileEx0);
for
(int i = 0; i < 70; i++)
{
        if
(true == isThreadAvailable(true))
      {
         ThreadPool.QueueUserWorkItem
(callBack,GetFileName(this.listView1.Items[i].ToString()));
      }
        else
      {
         MessageBox.Show
("Worker thread not available ");
      }
}