Advertisement
Guest User

Untitled

a guest
Jun 30th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. Result result1 = null;
  2. Result result2 = null;
  3.  
  4. var task1 = Task.Factory.StartNew(()=>
  5. {
  6. var records = DB.Read("..");
  7. //Do A lot
  8. result1 = Process(records);
  9. });
  10.  
  11. var task2 = Task.Factory.StartNew(()=>
  12. {
  13. var records = DB.Read(".....");
  14. //Do A lot
  15. result2 = Process(records);
  16. });
  17.  
  18. Task.WaitAll(task1, task2);
  19.  
  20. var result = Combine(result1, result2);
  21.  
  22. Result result1 = null;
  23. Result result2 = null;
  24.  
  25. var task1 = await Task.Factory.StartNew( async ()=>
  26. {
  27. var records = await DB.ReadAsync("..");
  28. //Do A lot
  29. result1 = Process(records);
  30. });
  31.  
  32. var task2 = await Task.Factory.StartNew(async ()=>
  33. {
  34. var records = await DB.ReadAsync(".....");
  35. //Do A lot
  36. result2 = Process(records);
  37. });
  38.  
  39. Task.WaitAll(task1, task2);
  40.  
  41. var result = Combine(result1, result2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement