Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. using System;
  2.  
  3. using System.Threading;
  4.  
  5.  
  6.  
  7. namespace Threading
  8.  
  9. {
  10.  
  11. class MainClass
  12.  
  13. {
  14.  
  15. public static int ida=0;
  16.  
  17. public static void Main (string[] args)
  18.  
  19. {
  20.  
  21. for(int a=1;a<=Environment.ProcessorCount;a++){
  22.  
  23. Console.WriteLine("Thread ID: "+a+" Started.");
  24.  
  25. Thread thrd = new Thread (Test);
  26.  
  27. thrd.Start();
  28.  
  29. }
  30.  
  31.  
  32.  
  33. //Console.WriteLine("DONE!");
  34.  
  35. Console.ReadKey();
  36.  
  37. }
  38.  
  39.  
  40.  
  41. public static void Test(){
  42.  
  43. ida++;
  44.  
  45. double a=new double();
  46.  
  47. for(int i=0;i<100000;i++){
  48.  
  49. a=Math.PI*i;
  50.  
  51. }
  52.  
  53. Console.WriteLine("DONE! "+ida);
  54.  
  55. }
  56.  
  57. }
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement