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; } }
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 DispatchFuture(UpdateDispatchViewModel view, DispatchFuture earlier) { this._view = view; this._earlier = earlier; }
public UpdateDispatchViewOrderEnforcingModel(DispatchService dispatchService, DispatchListener dispatchListener) { _currentFuture = new DispatchFuture(); // use a completed future as a start _dispatchService = dispatchService; _dispatchListener = dispatchListener; }