コード例 #1
0
ファイル: Program.cs プロジェクト: StoopMoss/422Repo
        public static void Main(string[] args)
        {
            int outvalue = 0;

            Console.WriteLine("QueueTests");

            queue = new PCQueue();

            for (int i = 0; i < 20; i++)
            {
                queue.Enqueue(i);
            }

            queue.printList();

            for (int i = 0; i < 20; i++)
            {
                queue.Dequeue(ref outvalue);
            }

            Thread t1 = new Thread(() => Dtest());
            Thread t2 = new Thread(() => Etest());

            t1.Start();
            t2.Start();

            Console.WriteLine("SorterTests");
            ThreadPoolSleepSorter sorter = new ThreadPoolSleepSorter(Console.Out, 10);

            byte[] values = { 1, 7, 8, 2, 3, 4, 5, 6, 9, 10 };
            sorter.Sort(values);
            sorter.Dispose();

            Console.WriteLine("done");
        }
コード例 #2
0
        public void SleepSortTest()
        {
            ThreadPoolSleepSorter sleepsort = new ThreadPoolSleepSorter(Console.Out, 10);

            Console.WriteLine("starting");

            sleepsort.Sort(new byte[] { 2, 5, 1 });
        }
コード例 #3
0
        static void Main(string[] args)
        {
            ThreadPoolSleepSorter sort = new ThreadPoolSleepSorter(Console.Out, 10);

            byte[] arr = new byte[] { 9, 8, 7, 6, 5, 4, 3, 2, 1 };
            sort.Sort(arr);

            byte[] arr1 = new byte[] { 8, 8, 7, 6, 5, 4, 3, 2, 1 };
            sort.Sort(arr1);

            //test testing = new test();

            //Thread t1 = new Thread(new ThreadStart(testing.enqueue));
            //Thread t2 = new Thread(new ThreadStart(testing.dequeue));
            ////Thread t = new Thread(new ThreadStart());
            //t1.Start();

            //t2.Start();
        }
コード例 #4
0
        static void Main(string[] args)
        {
            using (ThreadPoolSleepSorter sort = new ThreadPoolSleepSorter(Console.Out, 2))
            {
                byte[] arr = new byte[] { 9, 1 };
                sort.Sort(arr);
            }

            test testing = new test();

            Thread t1 = new Thread(new ThreadStart(testing.enqueue));
            Thread t2 = new Thread(new ThreadStart(testing.dequeue));
            //Thread t = new Thread(new ThreadStart());
            //t1.Start();

            //t2.Start();
        }
コード例 #5
0
        static void Main(string[] args)
        {
            /*
             * test testing = new test();
             *
             * Thread t1 = new Thread(new ThreadStart(testing.enqueue));
             * Thread t2 = new Thread(new ThreadStart(testing.dequeue));
             * t1.Start();
             * t2.Start();
             */

            ThreadPoolSleepSorter sort = new ThreadPoolSleepSorter(Console.Out, 10);

            byte[] arr = new byte[] { 9, 8, 7, 6, 5, 4, 3, 2, 1 };
            sort.Sort(arr);



            Console.ReadKey();

            sort.Dispose();

            //byte[] arr1 = new byte[] { 8, 8, 7, 6, 5, 4, 3, 2, 1 };
            //sort.Sort(arr1);


            /*
             * int out1=0, out2=0, out3 = 0;
             *
             * PCQueue q = new PCQueue();
             * q.Enqueue(2);
             * q.Enqueue(1);
             * q.Enqueue(3);
             * q.Enqueue(7);
             * q.Enqueue(12);
             * q.Enqueue(9);
             *
             * q.Dequeue(ref out1);
             * q.Dequeue(ref out2);
             * q.Dequeue(ref out3);
             *
             *
             * Console.ReadKey();
             */
        }
コード例 #6
0
        public void testSort()
        {
            ThreadPoolSleepSorter tpss = new ThreadPoolSleepSorter(Console.Out, 10);

            tpss.Sort(new byte[] { 2, 1, 3 });
        }