internal override void EnterState(InternalTransaction tx)
{
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 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._phase0Volatiles._preparedVolatileEnlistments <
volatileCount + dependentCount)
{
// Broadcast preprepare to the volatile subordinates
for (int i = 0; i < volatileCount; i++)
{
tx._phase0Volatiles._volatileEnlistments[i]._twoPhaseState.ChangeStatePreparing(
tx._phase0Volatiles._volatileEnlistments[i]);
if (!tx.State.ContinuePhase0Prepares())
{
break;
}
}
}
else
{
Phase0VolatilePrepareDone(tx);
}
}