Esempio n. 1
0
 static void Main(string[] args)
 {
     var tp = new MyThreadPool<long>(4);
     sw.Start();
     for(int i = 0; i < 1000; i++)
     {
         int i1 = i;
         tp.Add(CheckPrime, 15485867 + i1);
     //				Task.Run(() => CheckPrime(15485867 + i1));
     //				CheckPrime(15485867 + i1);
     }
     Console.ReadLine();
 }
Esempio n. 2
0
        static void Main()
        {

            Test1 a = new Test1();
            Test2 a1 = new Test2();
            Test3 a2 = new Test3();
            Mutex wait = new Mutex(false);
            MyThreadPool pool = new MyThreadPool(5, wait);
            for (int I = 0; I < 20; I++) pool.PutInQueue(new Test1());
               // pool.PutInQueue(a);
            //pool.PutInQueue(a1);
            //pool.PutInQueue(a2);
            Thread.Sleep(100);
            Console.ReadKey();
            pool.EndMyThreadPool();
            Console.ReadKey();
        }