System.Threading.Snzi.RootNode.Arrive C# (CSharp) Method

Arrive() public method

public Arrive ( ) : void
return void
			public void Arrive ()
			{
				int temp, x = 0;
				short c, v;
				bool a;
				
				do {
					x = var;
					
					Decode (x, out c, out a, out v);
					
					if (c == 0)
						temp = Encode (1, true, (short)(v + 1));
					else
						temp = Encode ((short)(c + 1), a, v);
				} while (Interlocked.CompareExchange (ref var, temp, x) != x);
				
				Decode (temp, out c, out a, out v);

				if (a) {
					while (true) {
						int i = state;
						int newI = (i & 0x7FFFFFFF) + 1;
						newI = (int)(((uint)newI) | 0x80000000);
						if (Interlocked.CompareExchange (ref state, newI, i) == i) {
							break;
						}
					}
					Interlocked.CompareExchange (ref var, Encode (c, false, v), temp);
				}
			}