public void run5() { FreePool p = new FreePool(2); MyPoolRunnable r1 = new MyPoolRunnable(Q2, false); Assert.IsFalse(r1.done); Assert.IsNull(r1.ex); MyPoolRunnable r2 = new MyPoolRunnable(Q2, false); Assert.IsFalse(r2.done); Assert.IsNull(r2.ex); p.Run(r1.run, r1.exception); p.Run(r2.run, r2.exception); Thread.Sleep(Q1); Assert.IsFalse(r1.done); Assert.IsNull(r1.ex); Assert.IsFalse(r2.done); Assert.IsNull(r2.ex); Thread.Sleep(Q3); Assert.IsTrue(r1.done); Assert.IsNull(r1.ex); Assert.IsTrue(r2.done); Assert.IsNull(r2.ex); }
public void join1() { // free pool thread count exceeded or pool closed FreePool p = new FreePool(2); p.Join(); MyPoolRunnable r = new MyPoolRunnable(0, false); p.Run(r.run, r.exception); }
public void join2() { FreePool p = new FreePool(2); MyPoolRunnable r = new MyPoolRunnable(0, false); Assert.IsFalse(r.done); Assert.IsNull(r.ex); p.Run(r.run, r.exception); Thread.Sleep(Q2); Assert.IsTrue(r.done); Assert.IsNull(r.ex); p.Join(); }
public void run3() { FreePool p = new FreePool(2); MyPoolRunnable r = new MyPoolRunnable(0, true); Assert.IsFalse(r.done); Assert.IsNull(r.ex); p.Run(r.run, r.exception); Thread.Sleep(Q1); Assert.IsFalse(r.done); Assert.IsNotNull(r.ex); }
public void run2() { FreePool p = new FreePool(2); for (int i = 0; i < 100; i++) { MyPoolRunnable r = new MyPoolRunnable(0, false); Assert.IsFalse(r.done); Assert.IsNull(r.ex); p.Run(r.run, r.exception); Thread.Sleep(Q1); Assert.IsTrue(r.done); Assert.IsNull(r.ex); } }
public void run6() { // free pool thread count exceeded FreePool p = new FreePool(2); MyPoolRunnable r1 = new MyPoolRunnable(Q2, false); Assert.IsFalse(r1.done); Assert.IsNull(r1.ex); MyPoolRunnable r2 = new MyPoolRunnable(Q2, false); Assert.IsFalse(r2.done); Assert.IsNull(r2.ex); MyPoolRunnable r3 = new MyPoolRunnable(Q2, false); Assert.IsFalse(r3.done); Assert.IsNull(r3.ex); p.Run(r1.run, r1.exception); p.Run(r2.run, r2.exception); p.Run(r3.run, r3.exception); }