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

29
LINES

< > BotCompany Repo | #1012126 // Test cancelledLiveThreads (OK)

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (2269L/15K).

1  
!7
2  
3  
p {
4  
  Thread t = startThread("Whoopsie", r {
5  
    while licensed {
6  
      print("sleeping");
7  
      sleep(1000);
8  
      print("done sleeping");
9  
    }
10  
  });
11  
    
12  
  assertEmpty(cancelledLiveThreads());
13  
  print("cancelling");
14  
  cancelThread(t);
15  
  assertNempty(cancelledLiveThreads());
16  
  t = null;
17  
18  
  while licensed {
19  
    gc();
20  
    L<Thread> threads = cancelledLiveThreads();
21  
    print(threads);
22  
    if (empty(threads)) break;
23  
    threads = null;
24  
    sleep(100);
25  
  }
26  
  
27  
  assertEmpty(cancelledLiveThreads());
28  
  print("OK");
29  
}

Author comment

Began life as a copy of #1012125

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1012126
Snippet name: Test cancelledLiveThreads (OK)
Eternal ID of this version: #1012126/3
Text MD5: 6cad82d0b028b23ea29763442e33e0ac
Transpilation MD5: 2bcc97bab6dbea9d6350ddc7eb8696bf
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-20 11:56:14
Source code size: 549 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 418 / 1123
Version history: 2 change(s)
Referenced in: [show references]