internal override void EnterState(InternalTransaction tx)
{
// Set the transaction state
CommonEnterState(tx);
// 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._phase0Volatiles._volatileEnlistmentCount;
int dependentCount = tx._phase0Volatiles._dependentClones;
// Store the number of phase0 volatiles for this wave.
tx._phase0VolatileWaveCount = volatileCount;
// Check for volatile enlistments
if (tx._phase0Volatiles._preparedVolatileEnlistments < volatileCount + dependentCount)
{
// Broadcast prepare to the phase 0 enlistments
for (int i = 0; i < volatileCount; i++)
{
tx._phase0Volatiles._volatileEnlistments[i]._twoPhaseState.ChangeStatePreparing(tx._phase0Volatiles._volatileEnlistments[i]);
if (!tx.State.ContinuePhase0Prepares())
{
break;
}
}
}
else
{
// No volatile enlistments. Start phase 1.
TransactionStatePromotedNonMSDTCVolatilePhase1.EnterState(tx);
}
}