Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. // X is a number much bigger than 5
  2. List<Task> tasks = new List<Task>();
  3. for (int i=0; i<X; i++)
  4. {
  5.  
  6. Task t = Task.Factory.StartNew(() => { requestFunc(url); },
  7. TaskCreationOptions.None);
  8. t.Wait(100); //slow down 100 ms. I am not sure if this is the right thing to do
  9. tasks.Add(t);
  10. }
  11.  
  12. Task.WaitAll(tasks);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement