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).

1  
!7
2  
3  
p-exp {
4  
  Thread thread = startThread(r {
5  
    while (true) {
6  
      busySleepSeconds_noPing(1);
7  
      ping();
8  
    }
9  
  });
10  
  thread {
11  
    sleep(random(3000));
12  
    printWithMS("Cancelling thread");
13  
    cancelThreadAndWait(thread);
14  
    printWithMS("Cancelled thread");
15  
  }
16  
  repeat 20 {
17  
    print("State: " + thread.getState());
18  
    sleepSeconds(1/3.0);
19  
  }
20  
}

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: 178 / 679
Version history: 6 change(s)
Referenced in: [show references]