/// <summary> /// Initializes a new instance of the <see cref="OperationScheduler"/> class. /// </summary> private OperationScheduler(Configuration configuration, SchedulingPolicy policy, IRandomValueGenerator generator) { this.Configuration = configuration; this.SchedulingPolicy = policy; this.ValueGenerator = generator; this.Reducers = new List <IScheduleReducer>(); if (configuration.IsSharedStateReductionEnabled) { this.Reducers.Add(new SharedStateReducer()); } if (!configuration.UserExplicitlySetLivenessTemperatureThreshold && configuration.MaxFairSchedulingSteps > 0) { configuration.LivenessTemperatureThreshold = configuration.MaxFairSchedulingSteps / 2; } if (this.SchedulingPolicy is SchedulingPolicy.Interleaving) { this.Strategy = InterleavingStrategy.Create(configuration, generator); if (this.Strategy is ReplayStrategy replayStrategy) { this.ReplayStrategy = replayStrategy; this.IsReplayingSchedule = true; } // Wrap the strategy inside a liveness checking strategy. if (configuration.IsLivenessCheckingEnabled) { this.Strategy = new TemperatureCheckingStrategy(configuration, generator, this.Strategy as InterleavingStrategy); } } else if (this.SchedulingPolicy is SchedulingPolicy.Fuzzing) { this.Strategy = FuzzingStrategy.Create(configuration, generator); } }
/// <summary> /// Initializes a new instance of the <see cref="LivenessCheckingStrategy"/> class. /// </summary> internal LivenessCheckingStrategy(Configuration configuration, IRandomValueGenerator generator, InterleavingStrategy strategy) : base(configuration, generator, strategy.IsFair) { this.SchedulingStrategy = strategy; }