Beispiel #1
0
 public static void Main()
 {
     ThrPool tpool = new ThrPool(5,10);
     // ThrWork work = null;
     for (int i = 0; i < 5; i++) {
         A a = new A(i);
         tpool.AssyncInvoke(new ThrWork(a.DoWorkA));
         B b = new B(i);
         tpool.AssyncInvoke(new ThrWork(b.DoWorkB));
     }
     Console.ReadLine();
 }
Beispiel #2
0
    public static void Main()
    {
        ThrPool tpool = new ThrPool(5, 10);
        ThrWork work  = null;

        for (int i = 0; i < 5; i++)
        {
            A a = new A(i);
            tpool.AssyncInvoke(new ThrWork(a.DoWorkA));
            B b = new B(i);
            tpool.AssyncInvoke(new ThrWork(b.DoWorkB));
        }
        Console.ReadLine();
    }
Beispiel #3
0
    public static void Main()
    {
        ThrPool tpool = new ThrPool(5, 10);

        for (int i = 0; i < 10; i++)
        {
            A a = new A(i);
            tpool.AssyncInvoke(new ThrWork(a.DoWorkA));

            B b = new B(i);
            tpool.AssyncInvoke(new ThrWork(b.DoWorkB));
        }

        //tpool.setEnd(true);
        Console.ReadLine();
    }
Beispiel #4
0
 public static void Main()
 {
     ThrPool tpool = new ThrPool(5, 10);
     ThrWork work = null;
     for (int i = 0; i < 5; i++)
     {
         A a = new A(i);
         tpool.AssyncInvoke(new ThrWork(a.DoWorkA));
         B b = new B(i);
         tpool.AssyncInvoke(new ThrWork(b.DoWorkB));
     }
     Thread.Sleep(100);
     Console.WriteLine("press enter to stop");
     Console.ReadLine();
     tpool.stop();
     Console.WriteLine("Thread Pool stopped successfully!\npress any key");
     Console.ReadLine();
 }