コード例 #1
0
ファイル: QueueLab.cs プロジェクト: VoikScorp/TestProjects
 public ThreadLab(string name, QueueLab <int> queue)
 {
     thrd      = new Thread(this.Run);
     queueLab  = queue;
     thrd.Name = name;
     thrd.Start();
 }
コード例 #2
0
        public static void TestQueue()
        {
            QueueLab <Int32> Queue = new QueueLab <int>();

            ThreadLab t1 = new ThreadLab("Pop", Queue);
            ThreadLab t2 = new ThreadLab("Push", Queue);
            ThreadLab t3 = new ThreadLab("Pop", Queue);
            ThreadLab t4 = new ThreadLab("Pop", Queue);
            ThreadLab t5 = new ThreadLab("Push", Queue);
            ThreadLab t6 = new ThreadLab("Push", Queue);

            t1.thrd.Join();
            t2.thrd.Join();
            t3.thrd.Join();
            t4.thrd.Join();
            t5.thrd.Join();
            t6.thrd.Join();
        }