Libraryless. Click here for Pure Java version (8017L/45K).
// returns last value of predicate sbool sleepWhile(IF0<Bool> pred, O... _) { optPar int interval = 50; // ms optPar double max = 10.0; // seconds long time = sysNow(); do { if (!pred!) false; sleep(interval); } while (sysNow() <= time+toMS(max)); true; }
Began life as a copy of #1015681
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1024356 |
Snippet name: | sleepWhile - poll predicate every 50 ms, end after 10 seconds (values changeable) |
Eternal ID of this version: | #1024356/6 |
Text MD5: | 27b096a895208bbf8a8c716228de0c1b |
Transpilation MD5: | 46db857ae3190a63836ca7546d898f2d |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-08-28 15:41:46 |
Source code size: | 285 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 324 / 441 |
Version history: | 5 change(s) |
Referenced in: | [show references] |