Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- namespace Cw1
- {
- class Program
- {
- static void ThreadTask()
- {
- while (true)
- {
- }
- }
- static void Main(string[] args)
- {
- var timer = new Stopwatch();
- timer.Start();
- var t = new Thread(ThreadTask);
- timer.Stop();
- Console.WriteLine("Tworzenie watku: {0}ms ({1} ticks)", timer.ElapsedMilliseconds, timer.ElapsedTicks);
- timer.Restart();
- t.Abort();
- while (t.IsAlive)
- {
- }
- timer.Stop();
- Console.WriteLine("Usuwanie watku: {0}ms ({1} ticks)", timer.ElapsedMilliseconds, timer.ElapsedTicks);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement