Пример #1
0
 public OtpActorSchedTask(OtpActor actor)
 {
     actor.Task = this;
     this.actor = actor;
     this.enumerator = actor.GetEnumerator();
 }
Пример #2
0
 public void react(OtpActor actor)
 {
     sched.react(actor);
 }
Пример #3
0
        public void react(OtpActor actor)
        {
            OtpActorSchedTask task = new OtpActorSchedTask(actor);
            IEnumerator<OtpActor.Continuation> enumerator = task.Enumerator;

            if (!enumerator.MoveNext())
            {
                task.Active = false;
            }
            else
            {
                Monitor.Enter(runnable);
                try
                {
                    task.Active = true;
                    runnable.Enqueue(task);
                    if (runnable.Count == 1)
                    {
                        Monitor.Pulse(runnable);
                    }
                }
                finally
                {
                    Monitor.Exit(runnable);
                }
            }
        }