!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); }