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

20
LINES

< > BotCompany Repo | #1028114 // Test cancelThreadAndWait [OK]

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

Download Jar. Libraryless. Click here for Pure Java version (7342L/51K).

!7

p-exp {
  Thread thread = startThread(r {
    while (true) {
      busySleepSeconds_noPing(1);
      ping();
    }
  });
  thread {
    sleep(random(3000));
    printWithMS("Cancelling thread");
    cancelThreadAndWait(thread);
    printWithMS("Cancelled thread");
  }
  repeat 20 {
    print("State: " + thread.getState());
    sleepSeconds(1/3.0);
  }
}

Author comment

Began life as a copy of #1017942

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028114
Snippet name: Test cancelThreadAndWait [OK]
Eternal ID of this version: #1028114/7
Text MD5: 13769be24b2f6db2296e69c9b5246f09
Transpilation MD5: 78f31fbf2042f7a4d6a392bc19964b90
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-05-20 13:12:19
Source code size: 378 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 166 / 654
Version history: 6 change(s)
Referenced in: [show references]