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

13
LINES

< > BotCompany Repo | #1019892 // dm_action - run action & allow user to cancel (by cancelling the thread). runs action in new thread

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

Libraryless. Click here for Pure Java version (3044L/19K).

svoid dm_action(fS desc, final Runnable r, O... _) {
  optPar bool printName = true;
  if (printName) print(desc);
  runInterruptibly(voidfunc(final Runnable interrupt) {
    temp AutoCloseable action = dm_currentAction(desc,
      r { print("INTERRUPTED"); callF(interrupt) });
    callF(r);
  });
}

svoid dm_action(Runnable r) {
  dm_action(str(r), r);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 10 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1019892
Snippet name: dm_action - run action & allow user to cancel (by cancelling the thread). runs action in new thread
Eternal ID of this version: #1019892/6
Text MD5: cd7f99d225be1742b20cad01c5d3747a
Transpilation MD5: b434e23901da464bf1b7207558e5878f
Author: stefan
Category: javax / stefan's os
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-08-13 15:09:15
Source code size: 369 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 428 / 567
Version history: 5 change(s)
Referenced in: [show references]