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

15
LINES

< > BotCompany Repo | #1027048 // waitUntil - wait for condition, check in regular intervals, poll-wait

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

Libraryless. Click here for Pure Java version (9964L/55K).

svoid waitUntil(int interval, IF0<Bool> condition) {
  if (condition == null) ret;
  while (!condition.get()) sleep(interval);
}

sbool waitUntil(int interval, double timeout, IF0<Bool> condition) {
  if (condition == null) false;
  long start = sysNow();
  while (sysNow() < start+toMS(timeout))
    if (condition.get())
      true;
    else
      sleep(interval);
  false;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027048
Snippet name: waitUntil - wait for condition, check in regular intervals, poll-wait
Eternal ID of this version: #1027048/5
Text MD5: bb623d1b44ee1d0900c7b9446191568f
Transpilation MD5: 854009b531f6167f4b6943de896f1c57
Author: stefan
Category: javax / stefan's os
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-11 17:38:24
Source code size: 390 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 413 / 568
Version history: 4 change(s)
Referenced in: [show references]