コード例 #1
0
            public override void Run()
            {
                // get first job
                PipelineJob job = Receive <PipelineJob>();

                PipelineJob nextJob = null;

                int receivedChunks = 1;


                while (receivedChunks <= numChunks)
                {
                    if (receivedChunks < numChunks)
                    {
                        // process all but last line
                        ImageProcessing.Process(filter, job.srcImage, job.resultImage, job.width, job.height, job.yStart, job.yEnd - 1);

                        // receive next job
                        nextJob = Receive <PipelineJob>();

                        // process last line
                        ImageProcessing.Process(filter, job.srcImage, job.resultImage, job.width, job.height, job.yEnd - 1, job.yEnd);
                    }
                    else // this is the last iteration
                    {
                        // process entire chunk
                        ImageProcessing.Process(filter, job.srcImage, job.resultImage, job.width, job.height, job.yStart, job.yEnd);
                    }

                    receivedChunks++;
                    // send result for this iteration to next stage
                    Send(job.Copy(), nextStage);
                    job = nextJob;
                }
            }