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

17
LINES

< > BotCompany Repo | #1016555 // interruptThread

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2517L/16K).

1  
sbool interruptThread_verbose;
2  
3  
svoid interruptThread(Thread t) {
4  
  if (t == null) ret;
5  
  if (interruptThread_verbose) print("Interrupting thread " + t);
6  
  
7  
  // note reason in global map
8  
  
9  
  vm_threadInterruptionReasonsMap().put(t, getStackTrace());
10  
  
11  
  t.interrupt();
12  
  URLConnection c = cast vm_generalSubMap("URLConnection per thread").get(t);
13  
  if (c != null) pcall {
14  
    print("Closing URLConnection of interrupted thread.");
15  
    call(c, 'disconnect);
16  
  }
17  
}

Author comment

Began life as a copy of #1008281

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1016555
Snippet name: interruptThread
Eternal ID of this version: #1016555/8
Text MD5: ae64ee1ecca32630206891bbb655880c
Transpilation MD5: 4fdd6cc3c59e9bd4e04b918704b2356d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-08-30 19:51:17
Source code size: 481 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 350 / 438
Version history: 7 change(s)
Referenced in: [show references]