示例#1
0
        public void Add(int[] payload)
        {
            _received.GetOrCreate().AddLast(payload);
            if (!_isDispatchWaiting.GetOrCreate())
            {
                DispatchFuture nextFuture;
                lock (this)
                {
                    nextFuture = new DispatchFuture(this, _currentFuture);
                    _currentFuture.Later = nextFuture;
                    _currentFuture = nextFuture;
                }

                _dispatchService.AddExternal(nextFuture);
                _isDispatchWaiting.Value = true;
            }
        }
示例#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;
        }
示例#3
0
 public DispatchFuture(UpdateDispatchViewModel view, DispatchFuture earlier)
 {
     this._view    = view;
     this._earlier = earlier;
 }
示例#4
0
 public UpdateDispatchViewOrderEnforcingModel(DispatchService dispatchService, DispatchListener dispatchListener)
 {
     _currentFuture = new DispatchFuture(); // use a completed future as a start
     _dispatchService = dispatchService;
     _dispatchListener = dispatchListener;
 }