示例#1
0
        public virtual void Attach(IPipeTarget <TOutput> target)
        {
            // TODO: weak references???
            Targets.Add(target);
            target.Sources.Add(this);

            _transformBlock.LinkTo(target);
            _transformBlock.Completion.ContinueWith(t =>
            {
                if (t.IsFaulted)
                {
                    ((IDataflowBlock)target).Fault(t.Exception);
                }
                else
                {
                    target.Complete();
                }
            });
        }
示例#2
0
        public virtual void Attach(IPipeTarget <TOutput> target)
        {
            // TODO: weak references???
            Targets.Add(target);
            target.Sources.Add(this);

            _actionBlock.Completion.ContinueWith(t =>
            {
                foreach (var target2 in Targets)
                {
                    if (t.IsFaulted)
                    {
                        ((IDataflowBlock)target2).Fault(t.Exception);
                    }
                    else
                    {
                        target2.Complete();
                    }
                }
            });
        }