Warning: session_start(): open(/var/lib/php/sessions/sess_uqto57f2escpbsel1ht4arcenl, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
svoid test_ThreadPool() {
new ThreadPool pool;
print(pool);
flagTest(flag -> pool.acquireThread((Runnable) flag), 10.0);
print(pool);
int n = pool.maxSize()*2;
new IntVar counter;
new IntVar waitCounter;
pool.onCustomerMustWaitAlert(-> inc(waitCounter));
for immutable i to n: {
var t = pool.acquireThread(r {
sleepSeconds((i+1)*0.2);
printWithMS(this + " done");
inc(counter);
});
printWithMS("Acquired thread " + t);
}
counter.waitForValue(n);
assertEquals(4, waitCounter!);
print(pool);
}