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;
            }
        }
コード例 #2
0
ファイル: DispatchFuture.cs プロジェクト: valmac/nesper
        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;
 }
コード例 #4
0
ファイル: DispatchFuture.cs プロジェクト: valmac/nesper
 public DispatchFuture(UpdateDispatchViewModel view, DispatchFuture earlier)
 {
     this.view    = view;
     this.earlier = earlier;
 }