protected void RunToCompletionWithDelayZero(Stack<TraversalInfo> searchStack)
{
var currentState = searchStack.Peek();
while (currentState.CurrentDepth < ZingerConfiguration.MaxDepthPerSchedule)
{
ZingerStats.MaxDepth = Math.Max(ZingerStats.MaxDepth, currentState.CurrentDepth);
TraversalInfo nextState = currentState.GetNextSuccessorUnderDelayZeroForRW();
ZingerStats.IncrementTransitionsCount();
ZingerStats.IncrementStatesCount();
if (nextState == null)
{
return;
}
//Check if the DFS Stack Overflow has occured.
if (currentState.CurrentDepth > ZingerConfiguration.BoundDFSStackLength)
{
//BUG FOUND
//update the safety traces
SafetyErrors.Add(currentState.GenerateNonCompactTrace());
// return value
this.lastErrorFound = ZingerResult.DFSStackOverFlowError;
throw new ZingerDFSStackOverFlow();
}
TerminalState terminal = nextState as TerminalState;
if (terminal != null)
{
if (terminal.IsErroneousTI)
{
lock (SafetyErrors)
{
SafetyErrors.Add(nextState.GenerateNonCompactTrace());
this.lastErrorFound = nextState.ErrorCode;
}
if (ZingerConfiguration.StopOnError)
{
//Stop all tasks
CancelTokenZingExplorer.Cancel(true);
throw nextState.Exception;
}
}
return;
}
searchStack.Push(nextState);
currentState = searchStack.Peek();
}
}