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

9
LINES

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

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

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

static <A> A pollWaitUntilNotNull(int interval, double timeout, IF0<A> condition) {
  if (condition == null) null;
  long start = sysNow();
  while (sysNow() < start+toMS(timeout)) {
    try object condition!;
    sleep(interval);
  }
  null;
}

Author comment

Began life as a copy of #1027048

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036419
Snippet name: pollWaitUntilNotNull - wait for condition, check in regular intervals, poll-wait
Eternal ID of this version: #1036419/2
Text MD5: ab5e672479d43a10fd09d6930d196d61
Transpilation MD5: d0d8277cee6dd72aa4554ec38e7e193d
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:41:55
Source code size: 252 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 59 / 89
Version history: 1 change(s)
Referenced in: [show references]