internal override void EnterState(InternalTransaction tx)
{
CommonEnterState(tx);
if (tx._committableTransaction != null)
{
// If we have a committable transaction then mark it as complete.
tx._committableTransaction._complete = true;
}
// If at this point there are phase1 dependent clones abort the transaction
if (tx._phase1Volatiles._dependentClones != 0)
{
tx.State.ChangeStateTransactionAborted(tx, null);
return;
}
// Get a copy of the current volatile enlistment count before entering this loop so that other
// threads don't affect the operation of this loop.
int volatileCount = tx._phase1Volatiles._volatileEnlistmentCount;
// Check to see if we still need to send out volatile prepare notifications or if
// they are all done. They may be done if the transaction was already in phase 0
// before it got promoted.
if (tx._phase1Volatiles._preparedVolatileEnlistments < volatileCount)
{
// Broadcast preprepare to the volatile subordinates
for (int i = 0; i < volatileCount; i++)
{
tx._phase1Volatiles._volatileEnlistments[i]._twoPhaseState.ChangeStatePreparing(
tx._phase1Volatiles._volatileEnlistments[i]);
if (!tx.State.ContinuePhase1Prepares())
{
break;
}
}
}
else
{
Phase1VolatilePrepareDone(tx);
}
}