Ejemplo n.º 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();
 }
Ejemplo n.º 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();
    }
Ejemplo n.º 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();
    }
Ejemplo n.º 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();
 }