System.Threading.Barrier.SetCurrentTotal C# (CSharp) Method

SetCurrentTotal() private method

Write the three variables current. total and the sense to the m_currentTotal
private SetCurrentTotal ( int currentTotal, int current, int total, bool sense ) : bool
currentTotal int The old current total to compare
current int The current cparticipant count
total int The total participants count
sense bool The sense flag
return bool
        private bool SetCurrentTotal(int currentTotal, int current, int total, bool sense)
        {
            int newCurrentTotal = (current << 16) | total;

            if (!sense)
            {
                newCurrentTotal |= SENSE_MASK;
            }

            #pragma warning disable 0420
            return Interlocked.CompareExchange(ref _currentTotalCount, newCurrentTotal, currentTotal) == currentTotal;
            #pragma warning restore 0420
        }