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

11
LINES

< > BotCompany Repo | #1035516 // waitForCalculatedValueUsingChangeListener - returns as soon as a non-null value is calculated

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

Libraryless. Click here for Pure Java version (9721L/54K).

static <A> A waitForCalculatedValueUsingChangeListener(double timeout default infinity(), IF0<A> f, IHasChangeListeners sender) {
  new BoolVar trigger;
  
  temp tempOnChange(sender, -> trigger.set(true));
  
  while true {
    ping();
    try object f!;
    trigger.waitUntilTrueAndClear(timeout);
  }
}

Author comment

Began life as a copy of #1035514

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035516
Snippet name: waitForCalculatedValueUsingChangeListener - returns as soon as a non-null value is calculated
Eternal ID of this version: #1035516/2
Text MD5: 6f5c04c971fcfc90da1376382e6bd688
Transpilation MD5: c657acc813336148244c8d355331234d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-09-01 21:33:00
Source code size: 315 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 130 / 180
Version history: 1 change(s)
Referenced in: [show references]