fix waitLoop

This commit is contained in:
andrey.bychkov
2024-09-17 11:28:29 +03:00
parent eb97de1413
commit bc6b584480

View File

@@ -13,10 +13,13 @@ PIClientServer::Server * createServer() {
bool waitLoop(std::function<bool()> exit_loop, const PISystemTime & timeout) { bool waitLoop(std::function<bool()> exit_loop, const PISystemTime & timeout) {
PITimeMeasurer tm; PITimeMeasurer tm;
while (!exit_loop() && (tm.elapsed() < timeout)) { while (tm.elapsed() < timeout) {
if (exit_loop()) {
return true;
}
piMinSleep(); piMinSleep();
} }
return tm.elapsed() < timeout; return false;
} }
template<typename Client> template<typename Client>