コード例 #1
0
        public void TestPipe()
        {
            SafeCounter     sc  = new SafeCounter();
            SmartThreadPool stp = new SmartThreadPool();

            stp.Pipe(
                sc,
                sc1 => { if (sc.Counter == 0)
                         {
                             sc1.Increment();
                         }
                },
                sc1 => { if (sc.Counter == 1)
                         {
                             sc1.Increment();
                         }
                },
                sc1 => { if (sc.Counter == 2)
                         {
                             sc1.Increment();
                         }
                }
                );

            Assert.AreEqual(3, sc.Counter);

            stp.Shutdown();
        }