コード例 #1
0
        private void FutureComplete(IFuture f)
        {
            _queueFutures.Remove(f);

            if (_queueFutures.Count > 0)
            {
                if (_current == f)
                {
                    _current = _queueFutures[0];
                }
            }
            else
            {
                _current = null;
            }

            if (onFutureComplete != null)
            {
                onFutureComplete(f);
            }

            if (_current != null)
            {
                _current.Run();
            }
        }
コード例 #2
0
        protected override void OnRun()
        {
            _delayFuture.AddListener(f =>
            {
                if (f.isDone)
                {
                    Complete();
                }
            });

            _timer = Timer.Create(_delay, () =>
            {
                _delayFuture.Run();
            }, null, true);
        }
コード例 #3
0
        public void AddFuture(IFuture future)
        {
            if (future.isDone || future.isCancelled || future.wasRun)
            {
                throw new Exception("future already run or completed");
            }

            _queueFutures.Add(future);
            future.AddListener(FutureComplete);

            if (_queueFutures.Count == 1)
            {
                _current = future;
                future.Run();
            }
        }
コード例 #4
0
        void CompleteFuture(IFuture future)
        {
            IFuture nextFuture = null;

            _compositeFutures.RemoveAt(0);
            if (_compositeFutures.Count > 0)
            {
                nextFuture = _compositeFutures[0];
            }

            if (nextFuture == null)
            {
                Complete();
            }
            else
            {
                nextFuture.Run();
            }
        }