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

20
LINES

< > BotCompany Repo | #1020593 - runInQAndWait - run in a queue, wait until done

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

Libraryless. Click here for Pure Java version (3679L/22K).

svoid runInQAndWait(Q q, Runnable r) {
  if (r == null) ret;
  if (isInQ(q)) ret with callF(r);
  
  final new Flag done;
  final new Var<Throwable> error;
  
  q.add(r {
    try {
      callF(r);
    } catch e {
      error.set(e);
    } finally {
      done.raise();
    }
  });
  
  done.waitUntilUp();
  if (error.has()) throw rethrow(error!);
}

Author comment

Began life as a copy of #1019896

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz

No comments. add comment

Snippet ID: #1020593
Snippet name: runInQAndWait - run in a queue, wait until done
Eternal ID of this version: #1020593/6
Text MD5: 1f36c8322889dce226067807ef2d38ce
Transpilation MD5: 269d61872d0771bb6a8e94e8e08403a0
Author: stefan
Category: javax / stefan's os
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-01 15:52:25
Source code size: 368 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 163 / 192
Version history: 5 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1020593 & http://1020593.tinybrain.de