Ejemplo n.º 1
0
        public IDisposable LinkTo(ITargetBlock <Tuple <T1, T2> > target, bool unlinkAfterOne)
        {
            var result = targets.AddTarget(target, unlinkAfterOne);

            outgoing.ProcessForTarget(target, this, false, ref headers);
            return(result);
        }
Ejemplo n.º 2
0
        void ProcessQueue()
        {
            ITargetBlock <T> target;
            T input;

            while (messageQueue.TryTake(out input))
            {
                if ((target = targets.Current) != null)
                {
                    target.OfferMessage(headers.Increment(), input, this, false);
                }
                else
                {
                    outgoing.AddData(input);
                }
            }

            if (!outgoing.IsEmpty && (target = targets.Current) != null)
            {
                outgoing.ProcessForTarget(target, this, false, ref headers);
            }
        }