Ejemplo n.º 1
0
        private IBehavior ReceiveMatching(Object msg)
        {
            IBehavior         tcs    = null;
            Queue <IBehavior> lQueue = null;

            while (fCompletions.TryTake(out tcs))
            {
                if (lQueue == null)
                {
                    lQueue = new Queue <IBehavior>();
                }
                if (!tcs.StandardPattern(msg))
                {
                    lQueue.Enqueue(tcs);
                    tcs = null;
                }
                else
                {
                    if (tcs.StandardCompletion != null)
                    {
                        break;
                    }
                    else
                    {
                        tcs = null;
                    }
                }
            }
            if (lQueue != null)
            {
                while (lQueue.Count > 0)
                {
                    fCompletions.Add(lQueue.Dequeue());
                }
            }
            return(tcs);
        }