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

12
LINES

< > BotCompany Repo | #1006169 // waitUntilVarSet

JavaX fragment (include)

static <A> A waitUntilVarSet(Var<A> v) ctex {
  synchronized(v) { while (!v.has()) v.wait(); ret v.get(); }
}

static <A> A waitUntilVarSet(Var<A> v, int timeout) ctex {
  synchronized(v) {
    long time = nanoTime();
    while (!v.has() && (nanoTime()-time) < timeout*900000)
      v.wait(timeout); // XXX-???
    ret v.get();
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006169
Snippet name: waitUntilVarSet
Eternal ID of this version: #1006169/3
Text MD5: a4b7b9e3bc36672ca5f48f45531f487b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-23 14:30:32
Source code size: 344 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 589 / 553
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1015837 - atomicFlipVarToTrue