System.Threading.Barrier.SetCurrentTotal C# (CSharp) 메소드

SetCurrentTotal() 개인적인 메소드

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
리턴 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
        }