System.Threading.CountdownEvent.ApplyOperation C# (CSharp) Method

ApplyOperation() private method

private ApplyOperation ( int num, Action doCheck, int &newValue ) : bool
num int
doCheck Action
newValue int
return bool
		bool ApplyOperation (int num, Action<int> doCheck, out int newValue)
		{
			int oldCount;
			newValue = 0;
			
			do {
				oldCount = count;
				if (oldCount == 0)
					return false;
				
				newValue = oldCount + num;
				
				if (doCheck != null)
					doCheck (newValue);
			} while (Interlocked.CompareExchange (ref count, newValue, oldCount) != oldCount);
			
			return true;
		}
		

Same methods

CountdownEvent::ApplyOperation ( int num, Action doCheck ) : bool