예제 #1
0
        /// <summary>
        /// Configures the P# runtime.
        /// </summary>
        /// <param name="configuration">Configuration</param>
        internal static void Configure(BugFindingConfiguration configuration)
        {
            PSharpRuntime.Configuration = configuration;

            PSharpRuntime.RootTaskId = Task.CurrentId;

            PSharpRuntime.MachineTasks = new List <Task>();
            PSharpRuntime.MachineMap   = new Dictionary <int, Machine>();
            PSharpRuntime.TaskMap      = new Dictionary <int, Machine>();
            PSharpRuntime.Monitors     = new List <Monitor>();

            if (PSharpRuntime.Configuration.ScheduleIntraMachineConcurrency)
            {
                PSharpRuntime.TaskScheduler         = new TaskWrapperScheduler(PSharpRuntime.MachineTasks);
                TaskMachineExtensions.TaskScheduler = PSharpRuntime.TaskScheduler as TaskWrapperScheduler;
            }

            MachineId.ResetMachineIDCounter();

            BugFindingDispatcher dispatcher = new BugFindingDispatcher();

            Machine.Dispatcher        = dispatcher;
            PSharp.Monitor.Dispatcher = dispatcher;

            PSharpRuntime.ProgramTrace    = new Trace();
            PSharpRuntime.StateCache      = new StateCache();
            PSharpRuntime.LivenessChecker = new LivenessChecker();

            PSharpRuntime.IsRunning = true;
        }
예제 #2
0
        /// <summary>
        /// Initializes the P# runtime.
        /// </summary>
        private static void Initialize()
        {
            PSharpRuntime.MainThreadId = Task.CurrentId;

            PSharpRuntime.MachineTasks = new List <Task>();
            PSharpRuntime.MachineMap   = new Dictionary <int, Machine>();
            PSharpRuntime.Monitors     = new List <Monitor>();

            MachineId.ResetMachineIDCounter();

            var dispatcher = new BugFindingDispatcher();

            Microsoft.PSharp.Machine.Dispatcher = dispatcher;
            Microsoft.PSharp.Monitor.Dispatcher = dispatcher;

            PSharpRuntime.StateExplorer   = new StateExplorer();
            PSharpRuntime.LivenessChecker = new LivenessChecker();

            PSharpRuntime.IsRunning = true;
        }