Exemplo n.º 1
0
        internal IFuture OnNextValue(object value)
        {
            OnEarlyDispose = null;

            int count;

            var seq = value as IEnumerable <T>;

            if (seq != null)
            {
                lock (_Buffer) {
                    _Buffer.AddRange(seq);
                    count = _Buffer.Count;
                }
            }
            else
            {
                T   convertedValue;
                var e = TryConvertValue(value, out convertedValue);

                if (e != null)
                {
                    Fail(e);

                    var f = new SignalFuture();
                    f.Fail(e);
                    return(f);
                }
                else
                {
                    lock (_Buffer) {
                        _Buffer.Add(convertedValue);
                        count = _Buffer.Count;
                    }
                }
            }

            if (count >= Capacity)
            {
                Resume();
                _ReadyForMoreFuture = new SignalFuture();
                return(_ReadyForMoreFuture);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
 public override void Fail(Exception ex)
 {
     Future.Fail(ex);
 }