Libraryless. Click here for Pure Java version (2544L/16K).
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
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027048 |
Snippet name: | waitUntil - wait for condition, check in regular intervals |
Eternal ID of this version: | #1027048/4 |
Text MD5: | bb623d1b44ee1d0900c7b9446191568f |
Transpilation MD5: | 3302b88084fe78cc4884de9cdba6ab0d |
Author: | stefan |
Category: | javax / stefan's os |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-07-01 17:05:05 |
Source code size: | 390 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 60 / 116 |
Version history: | 3 change(s) |
Referenced in: | #1006654 |
Formerly at http://tinybrain.de/1027048 & http://1027048.tinybrain.de