Transpiled version (5752L) is out of date.
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); }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1033408 |
| Snippet name: | test_ThreadPool (OK) |
| Eternal ID of this version: | #1033408/9 |
| Text MD5: | 41632b3a210b7a1a7e2b57536e8025f8 |
| Author: | stefan |
| Category: | javax / code execution |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-11-02 02:04:36 |
| Source code size: | 571 bytes / 22 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 391 / 519 |
| Version history: | 8 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |