/// <summary> /// Prepare for the next schedule by popping entries from the stack /// until we find some tid entries that are not slept. /// </summary> public void PrepareForNextSchedule() { if (this.Rand != null) { this.NextStackPos = 0; return; } { // Deadlock / sleep set blocked; no selected tid entry. TaskEntryList top = this.GetTopAsRealTop(); if (top.IsNoneSelected()) { this.Pop(); } } // Pop until there are some tid entries that are not done/slept OR stack is empty. while (this.StackInternal.Count > 0) { TaskEntryList top = this.GetTopAsRealTop(); if (top.BacktrackNondetChoices()) { break; } top.SetSelectedToSleep(); top.ClearSelected(); if (!top.AllDoneOrSlept()) { break; } this.Pop(); } this.NextStackPos = 0; }
private void AddTaskIdToRaceReplaySuffix(TaskEntryList tidEntryList) { // Add task id to the RaceReplaySuffix, but adjust // it for missing task ids. int tid = tidEntryList.GetSelected(); var index = this.MissingTaskIds.BinarySearch(tid); // Make it so index is the number of missing task ids before and including taskId. // e.g. if missingTaskIds = [3,6,9] // 3 => index + 1 = 1 // 4 => ~index = 1 if (index >= 0) { index += 1; } else { index = ~index; } this.RaceReplaySuffix.Add(new TidForRaceReplay(tid - index, tidEntryList.NondetChoices)); }