Libraryless. Click here for Pure Java version (14726L/102K).
!7 sclass ManySleepingThreads extends DynPrintLog { int number = 5; transient JTextField tfNumber; transient L<Thread> threads = synchroList(); JComponent visualize() { ret northAndCenterWithMargins(centerAndEastWithMarginInbetween(withLabel("Number of threads:", tfNumber = jLiveValueTextField(dm_fieldLiveValue('number))), jbutton("Make threads", rThread makeThreads)), super.visualize()); } void makeThreads { temp enter(); L<Thread> l = getAndClearList(threads); print("Interrupting " + n2(l, "thread")); interruptThreads(l); l = null; if (tfNumber != null) setField(number := parseInt(gtt(tfNumber))); for i to number: { threads.add(startThread("Sleeper", r sleep)); print("Made thread " + (i+1) + "/" + number); } } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1016693 |
Snippet name: | Many Sleeping Threads |
Eternal ID of this version: | #1016693/4 |
Text MD5: | 9a8382808f4002d710d379922ff1262b |
Transpilation MD5: | 60959ebfe4c1b3287b77e22fd77f244c |
Author: | stefan |
Category: | javax / stefan's os |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-06-28 12:54:59 |
Source code size: | 839 bytes / 28 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 402 / 557 |
Version history: | 3 change(s) |
Referenced in: | -