Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

10
LINES

< > BotCompany Repo | #1016642 // allThreads_fast

JavaX fragment (include)

1  
static L<Thread> allThreads_fast() {
2  
  ThreadGroup rootGroup = rootThreadGroup();
3  
  Thread[] threads = new Thread[rootGroup.activeCount()+10];
4  
  int n;
5  
  while ((n = rootGroup.enumerate(threads, true)) == threads.length)
6  
    threads = new Thread[threads.length*2];
7  
  L<Thread> l = new ArrayList<Thread>(n);
8  
  for (int i = 0; i < n; i++) l.add(threads[i]);
9  
  ret l;
10  
}

Author comment

Began life as a copy of #1016296

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: #1016642
Snippet name: allThreads_fast
Eternal ID of this version: #1016642/2
Text MD5: 7987226ca8834aedd44ea2f3d9d9eb32
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-26 15:07:15
Source code size: 375 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 468 / 472
Version history: 1 change(s)
Referenced in: [show references]