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

16
LINES

< > BotCompany Repo | #1007614 // evalInNewThread

JavaX fragment (include)

1  
static O evalInNewThread(fO f) {
2  
  final new Flag flag;
3  
  final new Var var;
4  
  final new Var<Throwable> exception;
5  
  thread {
6  
    try {
7  
      var.set(callF(f));
8  
    } catch e {
9  
      exception.set(e);
10  
    }
11  
    flag.raise();
12  
  }
13  
  flag.waitUntilUp();
14  
  if (exception.has()) throw rethrow(exception!);
15  
  ret var!;
16  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1007614
Snippet name: evalInNewThread
Eternal ID of this version: #1007614/2
Text MD5: 670eebbbb79ce1f4e103be2047b594ca
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-28 11:56:46
Source code size: 329 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 484 / 574
Version history: 1 change(s)
Referenced in: [show references]