Beispiel #1
0
        public static void Main()
        {
            ThreadQ = new Thread[2];
            myQueue = new PCQueue();
            Console.WriteLine("Hello World");


            ThreadQ [0] = new Thread(new ThreadStart(QueueItems));
            ThreadQ [1] = new Thread(new ThreadStart(DequeueItems));

            ThreadQ [0].Start();
            ThreadQ [1].Start();


            //			Console.WriteLine ("SleepSort");

            // Begin SleepSorter
//			Random rnd = new Random ();
//			byte[] rndList = new byte[100];
//
//
//
//			for (int i = 0; i < 100; i++) {
//				rndList[i] = (byte)rnd.Next (20);
//				Console.WriteLine ("{0} = {1}", i, rndList[i]);
//			}
//
//			ushort count = 100;
//			mySleepSorter = new ThreadPoolSleepSorter (Console.Out, count);
//			mySleepSorter.Sort (rndList);
//			mySleepSorter.Dispose ();

            Console.WriteLine("Done!");
        }
Beispiel #2
0
        static void Main()
        {
            /*var tpss = new ThreadPoolSleepSorter(Console.Out, 0);
             * var testArray = new byte[] {7, 1, 4, 2, 7, 3, 9};
             * tpss.Sort(testArray);
             * tpss.Dispose();
             * var testArray2 = new byte[]{5,3,1,7,3,8};
             * tpss.Sort(testArray2);*/
            //Thread.Sleep(2000);
            //tpss.Dispose();

            Thread t1 = new Thread(en);
            Thread t2 = new Thread(de);
            var    q  = new PCQueue();

            t1.Start(q);
            t2.Start(q);
        }