System.Transactions.TransactionStatePromotedBase.CompleteBlockingClone C# (CSharp) Method

CompleteBlockingClone() private method

private CompleteBlockingClone ( InternalTransaction tx ) : void
tx InternalTransaction
return void
        internal override void CompleteBlockingClone(InternalTransaction tx)
        {
            // First try to complete one of the internal blocking clones
            if (tx._phase0Volatiles._dependentClones > 0)
            {
                // decrement the number of clones
                tx._phase0Volatiles._dependentClones--;

                // Make certain we increment the right list.
                Debug.Assert(tx._phase0Volatiles._preparedVolatileEnlistments <=
                    tx._phase0Volatiles._volatileEnlistmentCount + tx._phase0Volatiles._dependentClones);

                // Check to see if all of the volatile enlistments are done.
                if (tx._phase0Volatiles._preparedVolatileEnlistments ==
                    tx._phase0VolatileWaveCount + tx._phase0Volatiles._dependentClones)
                {
                    tx.State.Phase0VolatilePrepareDone(tx);
                }
            }
            else
            {
                // Otherwise this must be a dependent clone created after promotion
                tx._phase0WaveDependentCloneCount--;
                Debug.Assert(tx._phase0WaveDependentCloneCount >= 0);
                if (tx._phase0WaveDependentCloneCount == 0)
                {
                    DistributedDependentTransaction dtx = tx._phase0WaveDependentClone;
                    tx._phase0WaveDependentClone = null;

                    Monitor.Exit(tx);
                    try
                    {
                        try
                        {
                            dtx.Complete();
                        }
                        finally
                        {
                            dtx.Dispose();
                        }
                    }
                    finally
                    {
                        Monitor.Enter(tx);
                    }
                }
            }
        }