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

32
LINES

< > BotCompany Repo | #1012125 // Test cancelledThreads (OK)

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

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

!7

p {
  Thread t = startThread("Whoopsie", r {
    while licensed {
      print("sleeping");
      sleep(1000);
      print("done sleeping");
    }
  });
    
  assertEmpty(cancelledThreads());
  print("cancelling");
  cancelThread(t);
  assertNempty(cancelledThreads());
  t = null;

  while licensed {
    gc();
    L<Thread> threads = cancelledThreads();
    
    // use System.err to clear reference to Whoopsie thread in x30.pout3
    System.err.println(threads);
    
    if (empty(threads)) break;
    threads = null;
    sleep(100);
  }
  
  assertEmpty(cancelledThreads());
  print("OK");
}

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: #1012125
Snippet name: Test cancelledThreads (OK)
Eternal ID of this version: #1012125/8
Text MD5: af96a6c8bff42983f52e154faf9890a2
Transpilation MD5: 353338fed4e1edd3d51ff1a00e90f124
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:42
Source code size: 632 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 399 / 831
Version history: 7 change(s)
Referenced in: [show references]