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

10
LINES

< > BotCompany Repo | #1016547 // waitForVarToChange_withTimeout - returns true if there was a change

JavaX fragment (include)

static <A> bool waitForVarToChange_withTimeout(Var<A> v, A knownValue, long timeout) ctex {
  synchronized(v) {
    long destTime = sysNow()+timeout, remainingTime;
    while ((remainingTime = destTime-sysNow()) > 0) {
      if (neq(knownValue, v!)) true;
      v.wait(remainingTime);
    }
    false;
  }
}
  

Author comment

Began life as a copy of #1016545

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1016547
Snippet name: waitForVarToChange_withTimeout - returns true if there was a change
Eternal ID of this version: #1016547/5
Text MD5: 6e40f60f8274ec250a2b351eb4569494
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:42:04
Source code size: 320 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 319 / 362
Version history: 4 change(s)
Referenced in: [show references]