示例#1
0
 internal void AfterTableClientState(TableClientState triggerState, Action action)
 {
     OnTableClientState(triggerState, () => {
         PSharpRuntime.SendEvent(machineId, new GenericDispatchableEvent(), new ActionDispatchable(action));
         return(Task.CompletedTask);
     });
 }
示例#2
0
        IMethodReturnMessage Invoke1 <TResult>(IMethodCallMessage callMsg)
        {
            // TODO: Create a reply ID once we know what information we need to include in it.
            var replyTarget = new ReplyTarget <TResult>(null, callerMachineId);

            PSharpRuntime.SendEvent(hostMachineId, eventFactory(),
                                    new CallPayload <TResult>(this, replyTarget, (MethodInfo)callMsg.MethodBase, callMsg.Args));
            return(new ReturnMessage(replyTarget.tcs.Task, null, 0, callMsg.LogicalCallContext, callMsg));
        }
示例#3
0
 public void SetOutcome(Outcome <TResult, Exception> outcome)
 {
     if (replied)
     {
         throw new InvalidOperationException();
     }
     PSharpRuntime.SendEvent(machineId, new GenericDispatchableEvent(), new ReplyPayload <TResult>(tcs, outcome));
     replied = true;
 }
示例#4
0
        public static MachineId NewMachine(this PSharpRuntime @this, Type type, Event e)
        {
            if (@this == null)
            {
                throw new ArgumentNullException(nameof(@this));
            }

            var machineId = @this.CreateMachine(type);

            if (e != null)
            {
                @this.SendEvent(machineId, e);
            }
            return(machineId);
        }
 /// <summary>
 /// Sends an asynchronous event to a machine.
 /// </summary>
 /// <param name="target">Target machine id</param>
 /// <param name="e">Event</param>
 void IRemoteCommunication.SendEvent(MachineId target, Event e)
 {
     Output.PrintLine("Received sent event {0}", e.GetType());
     PSharpRuntime.SendEvent(target, e);
 }
 public static void Send(PSharpRuntime runtime, MachineId target)
 {
     runtime.SendEvent(target, new E1(2));
 }
 public static void Send(PSharpRuntime runtime, MachineId target)
 {
     runtime.SendEvent(target, new E(2));
 }
示例#8
0
 public override void Post(SendOrPostCallback d, object state)
 {
     PSharpRuntime.SendEvent(machineId, new GenericDispatchableEvent(), new SynchronizationContextWorkUnit(d, state));
 }