Example #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();
 }
Example #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();
    }
Example #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();
    }
Example #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();
 }
Example #5
0
        /*
         * Constructs a singe node and registers it.
         */
        public Node(int id, int port, bool ensureSecurity)
        {
            Console.WriteLine("Creating Node...");

            this.channel   = new TcpChannel(port);
            this.url       = "tcp://" + Util.LocalIPAddress() + ":" + port + "/Node";
            this.trkUrl    = this.url;
            this.cluster   = new Dictionary <string, INode>();
            this.tracker   = this;
            this.splitWork = -1;

            this.workThr = new ThrPool(THREADPOOL_THREAD_NUMBER, THREADPOOL_BUFFER_SIZE);
            this.id      = id;
            this.jobs    = new List <Job>();



            ChannelServices.RegisterChannel(this.channel, ensureSecurity);
            RemotingServices.Marshal(this, "Node", typeof(Node));

            Console.WriteLine("Created node w/ ID: " + id + " @ " + this.URL);
        }
Example #6
0
 public Test(ThrPool t)
 {
     tpool = t;
 }
Example #7
0
 public Test(ThrPool t)
 {
     tpool = t;
 }