示例#1
0
        public static void InvokeMonitor(this PSharpRuntime @this, MonitorId target, Event e)
        {
            if (@this == null)
            {
                throw new ArgumentNullException(nameof(@this));
            }

            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            @this.InvokeMonitor(target.MonitorType, e);
        }
示例#2
0
        public static void RemoteInvokeMonitor(this PSharpRuntime @this, MonitorId target, Event e)
        {
            if (@this == null)
            {
                throw new ArgumentNullException(nameof(@this));
            }

            if (@this.NetworkProvider is ICommunicationProvider networkProvider2)
            {
                networkProvider2.RemoteMonitor(target, e);
                return;
            }

            @this.InvokeMonitor(target, e);
        }
示例#3
0
        public static MonitorId NewMonitor(this PSharpRuntime @this, Type type, Event e)
        {
            if (@this == null)
            {
                throw new ArgumentNullException(nameof(@this));
            }

            var monitorId = new MonitorId(@this, type);

            if (!GetRegisteredMonitors(@this).TryAdd(monitorId, null))
            {
                return(monitorId);
            }

            ms_extProps.GetOrCreateValue(@this).LastCreatedMonitorId = monitorId;
            @this.RegisterMonitor(type);
            if (e != null)
            {
                @this.InvokeMonitor(monitorId, e);
            }
            return(monitorId);
        }
示例#4
0
 internal static void SetMonitorId(this PSharpRuntime @this, MachineId internalMonitorId, MonitorId monitorId)
 {
     ms_extProps.GetOrCreateValue(@this).MonitorIdMap.AddOrUpdate(internalMonitorId, monitorId, (key, value) => monitorId);
 }