svoid test_ThreadPool() { new ThreadPool pool; print(pool); flagTest(flag -> pool.acquireThread((Runnable) flag); print(pool); int n = pool.maxSize()*2; new IntVar counter; repeat n { var t = pool.acquireThread(r { sleepSeconds(1.0); printWithMS(this + " done"); inc(counter); }); printWithMS("Acquired thread " + t); } counter.waitForValue(n); print(pool); }