void WithAtomicVal_Entry()
        {
            var result = 0L;

            for (var i = 0; i < NumIterations; i++)
            {
                if (_atomicVal.Value.A < i)
                {
                    result += _atomicVal.Get().A;
                }
                else
                {
                    result -= _atomicVal.Get().A;
                }

                BenchmarkUtils.SimulateContention(ContentionLevel);

                var curVal = _atomicVal.Get();

                BenchmarkUtils.SimulateContention(ContentionLevel);

                if (curVal.A >= _atomicVal.Get().A)
                {
                    if (_atomicVal.Get().B > _atomicVal.Get().C)
                    {
                        result += _atomicVal.Get().C;
                    }
                    else
                    {
                        result += _atomicVal.Get().B;
                    }
                }
                else
                {
                    if (_atomicVal.Get().B > _atomicVal.Get().C)
                    {
                        result += _atomicVal.Get().B;
                    }
                    else
                    {
                        result += _atomicVal.Get().C;
                    }
                }

                if (_atomicVal.Value.A < i)
                {
                    result += _atomicVal.Get().A;
                }
                else
                {
                    result -= _atomicVal.Get().A;
                }

                curVal = _atomicVal.Get();

                if (curVal.A >= _atomicVal.Get().A)
                {
                    if (_atomicVal.Get().B > _atomicVal.Get().C)
                    {
                        result += _atomicVal.Get().C;
                    }
                    else
                    {
                        result += _atomicVal.Get().B;
                    }
                }
                else
                {
                    if (_atomicVal.Get().B > _atomicVal.Get().C)
                    {
                        result += _atomicVal.Get().B;
                    }
                    else
                    {
                        result += _atomicVal.Get().C;
                    }
                }

                BenchmarkUtils.SimulateContention(ContentionLevel);

                if (i % IterationsPerBarrier == 0)
                {
                    if (_atomicVal.Get().B < curVal.A)
                    {
                        result += _atomicVal.TryExchange(new Val64(curVal.A - 1L), curVal).CurrentValue.A;
                    }
                    else
                    {
                        result += _atomicVal.TryExchange(new Val64(curVal.A + 1L), curVal).CurrentValue.A;
                    }
                    _atomicValSyncBarrier.SignalAndWait();
                }

                BenchmarkUtils.SimulateContention(ContentionLevel);
            }

            if (result == 0L)
            {
                Console.Beep(1000, 100);
            }
        }
        void WithAtomicVal_Entry()
        {
            var result = 0L;

            for (var i = 0; i < NumIterations; i++)
            {
                if (_atomicVal.Value.L < i)
                {
                    result += _atomicVal.Get().L;
                }
                else
                {
                    result -= _atomicVal.Get().L;
                }

                BenchmarkUtils.SimulateContention(ContentionLevel);

                var curVal = _atomicVal.Get();

                BenchmarkUtils.SimulateContention(ContentionLevel);

                if (curVal.L >= _atomicVal.Get().L)
                {
                    if (_atomicVal.Get().X > _atomicVal.Get().Y)
                    {
                        result += (long)_atomicVal.Get().Y;
                    }
                    else
                    {
                        result += (long)_atomicVal.Get().X;
                    }
                }
                else
                {
                    if (_atomicVal.Get().X > _atomicVal.Get().Y)
                    {
                        result += (long)_atomicVal.Get().X;
                    }
                    else
                    {
                        result += (long)_atomicVal.Get().Y;
                    }
                }

                if (_atomicVal.Value.L < i)
                {
                    result += _atomicVal.Get().L;
                }
                else
                {
                    result -= _atomicVal.Get().L;
                }

                curVal = _atomicVal.Get();

                if (curVal.L >= _atomicVal.Get().L)
                {
                    if (_atomicVal.Get().X > _atomicVal.Get().Y)
                    {
                        result += (long)_atomicVal.Get().Y;
                    }
                    else
                    {
                        result += (long)_atomicVal.Get().X;
                    }
                }
                else
                {
                    if (_atomicVal.Get().X > _atomicVal.Get().Y)
                    {
                        result += (long)_atomicVal.Get().X;
                    }
                    else
                    {
                        result += (long)_atomicVal.Get().Y;
                    }
                }

                BenchmarkUtils.SimulateContention(ContentionLevel);

                if (i % IterationsPerBarrier == 0)
                {
                    if (_atomicVal.Get().X < curVal.L)
                    {
                        result += _atomicVal.TryExchange(new Vector2(curVal.L - 1L), curVal).CurrentValue.L;
                    }
                    else
                    {
                        result += _atomicVal.TryExchange(new Vector2(curVal.L + 1L), curVal).CurrentValue.L;
                    }
                    _atomicValSyncBarrier.SignalAndWait();
                }

                BenchmarkUtils.SimulateContention(ContentionLevel);
            }

            if (result == 0L)
            {
                Console.Beep(1000, 100);
            }
        }