public void Add(int[] payload)
        {
            var local = LocalData;

            local.Received.AddLast(payload);
            if (!local.IsDispatchWaiting)
            {
                DispatchFuture nextFuture;
                lock (this)
                {
                    nextFuture          = new DispatchFuture(this, currentFuture);
                    currentFuture.Later = nextFuture;
                    currentFuture       = nextFuture;
                }
                dispatchService.AddExternal(nextFuture);
                local.IsDispatchWaiting = true;
            }
        }
Beispiel #2
0
        public void Execute()
        {
            while (!earlier.isCompleted)
            {
                lock (this) {
                    Monitor.Wait(this, 1000);
                }
            }

            view.Execute();
            isCompleted = true;

            if (later != null)
            {
                lock (later)
                {
                    Monitor.PulseAll(later);
                }
            }
            earlier = null;
            later   = null;
        }
 public UpdateDispatchViewOrderEnforcingModel(DispatchService dispatchService, DispatchListener dispatchListener)
 {
     this.currentFuture    = new DispatchFuture(); // use a completed future as a start
     this.dispatchService  = dispatchService;
     this.dispatchListener = dispatchListener;
 }
Beispiel #4
0
 public DispatchFuture(UpdateDispatchViewModel view, DispatchFuture earlier)
 {
     this.view    = view;
     this.earlier = earlier;
 }