Advertisement
miljdze

Untitled

Jun 5th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Threading;
  7. using System.Diagnostics;
  8. namespace vrijemeOgranicenje
  9. {
  10. class Program
  11. {
  12. static void Ispisi()
  13. {
  14. int m = 1;
  15. Console.WriteLine("Ispisujem ovo {0}. put", m);
  16. m++;
  17.  
  18. }
  19.  
  20. static void Main(string[] args)
  21. {
  22. Stopwatch stoperica = new Stopwatch();
  23. TimeSpan ogranicenje = new TimeSpan(0,0,0,0,30000);
  24.  
  25. stoperica.Start();
  26. while (stoperica.ElapsedMilliseconds < ogranicenje.TotalMilliseconds)
  27. {
  28. Thread th = new Thread(Ispisi);
  29. th.Start();
  30. th.Join();
  31. }
  32. stoperica.Stop();
  33. Console.WriteLine("Vrijeme isteklo");
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement