!7 static int serveLongPoll_checkInterval = 100; // f: func -> O (null or empty string if no result yet) static O serveLongPoll(long timeout, int interval, O f) { long startTime = sysNow(); while (sysNow() < startTime+timeout) { O o = callF(f); if (nempty(o)) ret o; sleep(serveLongPoll_checkInterval); } ret ""; } static O serveLongPoll(long timeout, O f) { ret serveLongPoll(timeout, serveLongPoll_checkInterval, f); }
Began life as a copy of #1014866
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1014921 |
Snippet name: | serveLongPoll |
Eternal ID of this version: | #1014921/3 |
Text MD5: | 9a9e15c029e9bb3e0949750f97904f9e |
Author: | stefan |
Category: | javax / web / a.i. / android |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-06 14:23:01 |
Source code size: | 462 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 403 / 441 |
Version history: | 2 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |