Exemplo n.º 1
0
        public static void FirstThread()
        {
            Console.WriteLine($"Thread {Thread.CurrentThread.ManagedThreadId} is executing Gcd.CalculateGcd(Gcd.BinaryAlgorithm, 4, 16, 16, 8)");
            sw.Start();
            int x = Gcd.CalculateGcd(Gcd.BinaryAlgorithm, 4, 16, 16, 8);

            sw.Stop();
            sw.Reset();
            Console.WriteLine("x = " + x);
            Console.WriteLine(sw.Elapsed);
        }
Exemplo n.º 2
0
        public static void SecondThread()
        {
            Console.WriteLine($"Thread {Thread.CurrentThread.ManagedThreadId} is executing Gcd.CalculateGcd(Gcd.EuclideanAlgorithm, 4, 16, 16, 8)");
            sw.Start();
            int y = Gcd.CalculateGcd(Gcd.EuclideanAlgorithm, 4, 16, 16, 8);

            sw.Stop();
            sw.Reset();
            Console.WriteLine("y = " + y);
            Console.WriteLine(sw.Elapsed);
        }