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

24
LINES

< > BotCompany Repo | #1019332 // pcallFParallel

JavaX fragment (include)

static <A> L<A> pcallFParallel(F0<A>... functions) {
  ret pcallFParallel(asList(functions));
}

static <A> L<A> pcallFParallel(L<F0<A>> functions) {
  int n = l(functions);
  L<A> outInner = repNull(n);
  final L<A> out = synchroList(outInner);
  new L<Steppable> steppables;
  for i to n: {
    final F0<A> f = functions.get(i);
    final int _i = i;
    steppables.add(new Steppable {
      public bool step() {
        out.set(_i, pcallF(f));
        false;
      }
    });
  }
  new Flag done;
  new MultiThreadStepper(steppables).onDone(rRaiseFlag(done)).start();
  done.waitUntilUp();
  ret outInner;
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1019332
Snippet name: pcallFParallel
Eternal ID of this version: #1019332/6
Text MD5: 65995c02e948552747af9935884c3bc8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-01 12:36:17
Source code size: 632 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 314 / 349
Version history: 5 change(s)
Referenced in: [show references]