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(); }
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(); }
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(); }
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(); }
/* * 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); }
public Test(ThrPool t) { tpool = t; }