AdvancedMultithreadingLab.MiscBenchmarks.TestContendedEnter C# (CSharp) Метод

TestContendedEnter() статический приватный Метод

static private TestContendedEnter ( ) : void
Результат void
        static void TestContendedEnter()
        {
            const int n = 100000000;

            Stopwatch stopwatch = Stopwatch.StartNew();
            int j = 0;
            for (int i = 0; i < n; i++)
            {
                lock ( sync )
                {
                    j++;
                }

            }
            stopwatch.Stop();

            WriteTime("Contented Monitor", n, stopwatch.ElapsedTicks);
        }