コード例 #1
0
        public override Task[] Work()
        {
            //Console.WriteLine("{0} working", this);

            //if input channel is not empty
            if (input1 != null)
            {
                do
                {
                    input1.Recv(ref message1);
                    for (int i = 0; i < message1.length; i++)
                    {
                        OnInput1(message1.payload[i]);
                    }
                }while (!message1.Final);
            }

            // if the input channel was not empty, schedule dependents.
            if (message1.status == MessageStatus.FinalNonEmpty)
            {
                Compute();
                //basically like flush
                DoneSending();
                //additional tasks we have to do, possible nothing
                return(dependents);
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
        public override Task[] Work()
        {
            //Console.WriteLine("{0} working", this);

            if (input1 != null)
            {
                do
                {
                    input1.Recv(ref message1);
                    for (int i = 0; i < message1.length; i++)
                    {
                        OnInput1(message1.payload[i]);
                    }
                }while (!message1.Final);
            }

            if (input2 != null)
            {
                do
                {
                    input2.Recv(ref message2);
                    for (int i = 0; i < message2.length; i++)
                    {
                        OnInput2(message2.payload[i]);
                    }
                }while (!message2.Final);
            }

            // if the input channel was not empty, schedule dependents.
            if (message1.status == MessageStatus.FinalNonEmpty || message2.status == MessageStatus.FinalNonEmpty)
            {
                Compute();

                DoneSending();

                return(dependents);
            }
            else
            {
                return(null);
            }
        }